[Vm-dev] FFI: Vararg function how to tell callee how many arguments i passed?

Igor Stasenko siguctua at gmail.com
Sun Sep 26 23:23:43 UTC 2010


On 27 September 2010 02:12, Levente Uzonyi <leves at elte.hu> wrote:
>
> On Mon, 27 Sep 2010, Igor Stasenko wrote:
>
>>
>> Suppose i want to call printf() using FFI.
>> But it is a variable argument function. What should do to let it know
>> how many arguments i passed?
>
> I think you don't tell it, it guesses the number of arguments from the first
> argument. If you pass invalid arguments, something bad will happen. :)
>

Yeah.. i inspected the assembly (gcc -s) for printf call,
and there is only pushes of arguments , no extra info.

>
> Levente
>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>



-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list