|
From: Adam W. <li...@co...> - 2005-02-17 08:56:54
|
Hi all, [Christophe, thanks for fixing the format ~@F bug I reported] In <http://www.sbcl.org/manual/Foreign-Type-Specifiers.html> it states: Lisp strings are stored with a trailing NUL termination, so no copying (either by the user or the implementation) is necessary when passing them to foreign code. Characters in SBCL strings are now stored as 32-bit values: (let ((sap (sb-sys:int-sap (sb-kernel:get-lisp-obj-address "ABC")))) (dotimes (i (* 3 4)) (format t "~A " (sb-sys:sap-ref-8 sap (1+ i))))) => 65 0 0 0 66 0 0 0 67 0 0 0 These obviously have to be copied to build a C string (pointer to a 0 terminated array of char). Also: <http://www.sbcl.org/manual/Step-By-Step-Example-of-the-Foreign-Function-Interface.html> Once the C code has been compiled, you can start up Lisp and load it in: sbcl Lisp should start up with its normal prompt. I suspect this should read: Once the C code has been compiled, you can start up Lisp and load it in: (sb-alien:load-shared-object "test.so") Regards, Adam |