Raymond Toy [[EMAIL PROTECTED]] wrote:

> >>>>> "ecm" == Eric Marsden <[EMAIL PROTECTED]> writes:

> >>>>> "kd" == Kick Damien-DKICK1 <[EMAIL PROTECTED]> writes:

>     kd> I've been reading the CMU CL FFI documentation
>     kd> <http://cvs2.cons.org/ftp-area/cmucl/doc/cmu-user/aliens.html>
>     kd> and I don't see any mention of how to represent variadic
>     kd> arguments with it.  Can this be done?

>     ecm> I don't think that this is possible with the CMUCL FFI
>     ecm> (indeed I don't know of any other FFI that handles it --
>     ecm> the vararg calling convention is tricky to emulate).

I have been able to find something called ffcall
<http://www.haible.de/bruno/packages-ffcall-README.html>, "a
collection of four libraries which can be used to build foreign
function call interfaces in embedded interpreters" (apparently a
package for CLISP?), which seems to be able to support "calling C
functions with variable arguments" via "avcall"
<http://www.haible.de/bruno/documentation/ffcall/avcall/avcall.html>.
I have no idea if this is a fully-functioning implementation, if it is
something of a proof of concept that never went any further, or if I
am misreading things entirely.  I was hoping that there might be
something similiar for CMU CL, assuming that I have the right idea
about what ffcall is/does, of course.

>     ecm> The best that you can do is write C wrappers with fixed
>     ecm> arglists for each of the signatures that you need, and bind
>     ecm> to the wrapper functions.

> [...] As a workaround, couldn't you define the FFI with the largest
> number of args you expect to use and then have a macro to call the
> ffi with the appropriate real, defined number of args.

Well, it would be possible but not nearly as "clean" as being able to
use some hyptothetical FFI equivalent of '&rest'/'...'.

--
Damien Kick

Reply via email to