At 08:57 PM 10/12/00 +0100, Simon Cozens wrote:
>On Thu, Oct 12, 2000 at 03:43:07PM -0400, Dan Sugalski wrote:
> > Doing this also means someone writing an app with an embedded perl
> > interpreter can call into perl code the same way as they call into any C
> > library.
>
>Of course, the problem comes that we can't have anonymous functions in C.
Sure we do. You can get a pointer to a function, and then call that
function through the pointer. (Though argument handling's rather dodgy)
>That is, if we want to call Perl sub "foo", we'll really need to call
>something like
>
> call_perl("foo", ..args... );
>
>whereas we'd much rather do this:
>
> foo(..args..)
>
>(Especially since C's handling of varargs is, well, unpleasant.)
C's vararg handling sucks in many sublime and profound ways. It does,
though, work. If we declare in advance that all C-visible perl functions
have an official parameter list of (...), then we can make it work. The
calling program would just fetch function pointers from us somehow, and do
the call in.
Granted this will be a pain on our side (since I expect the C vararg stuff
is very different from platform to platform, even more so (and more
annoyingly) than plain function call stuff) but it is doable.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk