This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi, This is a naive question. Is there any particular reason people seem to prefer libffi to ffcall? I'm only familiar with ffcall, and it seems OK. I have some code that does essentially the same thing as the libffi module, but I've never got around to packaging it. I've used it (along with some code to get direct access to C pointers) to hack directly at the lowest levels of Xt. Cheers, Clark PS: The ffcall web page is: <http://clisp.cons.org/~haible/documentation/ffcall> PPS: Part of the reason I haven't tried to contribute this is that the module system is a little up in the air and I was never sure where the compiled guile modules belonged. Discussing this on the list really helped. PPPS: As far as I can see, the only advantage ffcall has to ffi is that you can create a callback for C directly in scheme. For example: (define c-callback (callback (lambda (a b) (+ a b)) 'int '(int int))) makes c-callback a pointer to a function with a C prototype: int afunc(int, int); which will execute "(lambda (a b) (+ a b))". If there is a C function that needs a callback, then you can use your scheme directly: void c_needs_a_callback(int (*func)(int,int)) { int i = func(1,2); } calls "(lambda (a b) (+ a b))" from deep in side a C library without knowing about guile (assuming func holds the address returned by "callback").