![](https://secure.gravatar.com/avatar/fa1e806f97322661e06279d2f35e7ab8.jpg?s=120&d=mm&r=g)
On Sat, 2012-09-22 at 21:27 +0200, Frank Goenninger wrote:
(also posted to comp.lang.lisp)
Hi all:
I have a lisp image that contains the following functions:
(defun frgo (a) (format *debug-io* "~%~A~&" a) (values))
(cffi:defcallback frgo_helper :void ((a-cstr :string)) (frgo (cffi:foreign-string-to-lisp a-cstr)))
In a C dynamic library I have:
* file frgo_c.h:
extern void frgo_helper( char * a );
* file frgo_c.c:
void frgo( char * a ) { frgo_helper( a ); }
Now, the library does not compile - undefined symbol _frgo_helper() !
How do I make functions "known" to C land that are purely defined as callbacks in Lisp land?
You can't do that directly. Lisp callbacks must be passed to the C code as function pointers. You could write a C wrapper that calls the callback through a global variable and have the Lisp-side store the address of the callback in that variable. -- Stelian Ionescu a.k.a. fe[nl]ix Quidquid latine dictum sit, altum videtur. http://common-lisp.net/project/iolib