On Oct 30, 2005, at 1:54, Nick Glencross wrote:
Quick question...
I've been looking through inter_run and extend to see how to pass
arguments to a parrot method/function from C, but all the prototypes
that I've seen have '...' or 'va_list' to accept the arguments.
If I don't know what the arguments or their respective types are at
compile time, what function is best for me?
There are 2 cases here:
1) you know the amount of args
2) you don't
In both cases you can use Parrot_runops_fromc_args() with a signature
of "vPPP" or "vP" respectively.
If you expect a return value change the initial 'v' to 'P'. For the
second case you have to put all args into a *PMCArray.
The types of arguments don't really matter, because the new calling
conventions provide automatic conversion.
[It's not possible to construct a va_list, is it?]
No, but I can imagine that one additional signature char '*' or such
meaning ':flat" would help in the case of 2) above.
Thanks!
Nick
leo