>>>>> "Leopold" == Leopold Toetsch <[EMAIL PROTECTED]> writes:
Leopold> Colin Paul Adams <[EMAIL PROTECTED]> wrote: >> I have a problem with this - namely that the function is >> variadic, and the interface generator can't cope with this.
Leopold> Have a look at src/inter_run.c e.g.
Leopold> <void * Parrot_runops_fromc_arglist(Parrot_Interp Leopold> interpreter, PMC *sub, const char *sig, va_list args)>
Despite what I said before, this is actually worse than Parrot_call_sub. The interface generator ignores it completely, rather than generating an incorrect signature (I suppose that's an improvement really, except then it can't even be used for subroutines which accept zero arguments).
Then the question is: What'd work? There are limits to what's going to be useful if you're not in a position to do full variadic function calls, and I'm not sure that we should put too many special cases in. On the other hand, I know how much of a pain this can be, since I did the first implementation of parrot's NCI interface, which has the same sorts of issues to deal with.
So, I see four real options:
1) Someone fixes the Eiffel interface generator to understand C variadic functions.
2) We provide a function and method call interface that assumes you've already pre-filled in the registers according to parrot's calling conventions
3) We build some sort of really simple call interface that takes an array PMC with the parameters stuffed into it
4) Parrot provides some sort of facility to autogenerate shim functions based on a passed-in signature
None of them are particularly good, and they'll all potentially cause you problems with an interface generator. 1's the best (and not just because it means we don't have to do anything :) but that's probably untenable. #4 is probably the next easiest thing, but I'm not sure that you could use that without at least some tweaks to the interface generator, and it'd be a bit dodgy on systems we don't have JIT capabilities on. #s 2&3 are sub-optimal, and either require some work on the caller's part (or changes to the interface generator) or kinda limit what you can do.
Teaching the interface generator about variadic functions is probably the easiest thing -- in principle it's not that tough (Hey, I did one, I get to say that :) though that does depend on what the code in the interface generator looks like.
--
Dan
--------------------------------------it's like this------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk