[cffi-devel] foreign-symbol-pointer weirdness

Samium Gromoff _deepfire at mail.ru
Mon Apr 10 22:42:19 UTC 2006


On Tue, 2006-04-11 at 01:55 +0400, Samium Gromoff wrote:
> here is the scenario:

[snip]

> (let ((foreign-ptr (foreign-symbol-pointer
> "verse_send_connect_accept" :code)))
>   (format t "foreign-ptr contents: ")
>   (dotimes (i 16)
>     (format t "~2,'0X " (the (unsigned-byte 8) (mem-ref
> foreign-ptr :uint8 i))))
>   (format t "~%"))
> 
> This code gives different printouts on CLISP/CMUCL/SBCL backends:
> 
> CLISP:
> foreign-ptr contents: 55 89 E5 83 EC 28 8B 45 0C 89 44 24 04 8D 45 F8
> CMUCL:
> foreign-ptr contents: E9 26 AE C3 F9 90 00 00 00 00 00 00 00 00 00 00
> SBCL:
> foreign-ptr contents: E9 CE A2 A1 47 90 00 00 00 00 00 00 00 00 00 00
> 
> This amounts to foreign-symbol-pointer finding different things
> on different lisps, in the same shared library.

Luis Olivera suggested using (foreign-symbol-pointer ... :data) instead
of (foreign-symbol-pointer ... :code), and it worked just fine, now
providing pointers to exactly same code!

Apparently in the CMU/SBCL case i`ve been fed pointers to proc linkage
table entries or some lisp-specific trampolines.

respectfully, Samium Gromoff




More information about the cffi-devel mailing list