[cffi-devel] Re: CFFI Callbacks on SBCL
James Bielman
jamesjb at jamesjb.com
Sun Jan 1 01:37:23 UTC 2006
On Sat, 2005-12-31 at 17:59 +0000, Luís Oliveira wrote:
> I'm Cc-ing cffi-devel and sbcl-devel, since I'm sure more people will
> be interested in this and hopefully others will help in figuring this
> out.
Here's another example I cooked up before I read Luis's e-mail:
This is SBCL 0.9.8, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (sb-alien::define-alien-callback foo int () 42)
; [snip unused var warning]
; compilation unit finished
; caught 1 STYLE-WARNING condition
FOO
* (alien-funcall foo)
42
* (save-lisp-and-die "foo.core")
[undoing binding stack and other enclosing state... done]
[saving current Lisp image into /home/jamesjb/foo.core:
writing 1664 bytes from the read-only space at 0x01000000
writing 1776 bytes from the static space at 0x05000000
writing 23977984 bytes from the dynamic space at 0x09000000
sdone]
[jamesjb at zeta 1795:~] sbcl --core foo.core
This is SBCL 0.9.8, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (alien-funcall foo)
debugger invoked on a SB-KERNEL::MEMORY-FAULT-ERROR in thread
#<THREAD "initial thread" {A6E0309}>:
memory fault
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-KERNEL::MEMORY-FAULT-ERROR)
0] back
0: (SB-KERNEL::MEMORY-FAULT-ERROR)
1: ("foreign function: call_into_lisp")
2: ("foreign function: post_signal_tramp")
3: ("foreign function: #x8B2F408B")
4: ("foreign function: #x500000B")
5: ("foreign function: funcall3")
6: ("foreign function: #x50006D3")
7: (NIL #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X050006B8 :TYPE #'(SIGNED 32)>)
8: (SB-INT:EVAL-IN-LEXENV (ALIEN-FUNCALL FOO) #<NULL-LEXENV>)
9: (INTERACTIVE-EVAL (ALIEN-FUNCALL FOO))
10: (SB-IMPL::REPL-FUN NIL)
11: ((LAMBDA ()))
12: ((LAMBDA ()))
13: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA #) {A70453D}>)
14: (SB-IMPL::TOPLEVEL-REPL NIL)
15: (SB-IMPL::TOPLEVEL-INIT)
16: ((LABELS SB-IMPL::RESTART-LISP))
0]
More information about the cffi-devel
mailing list