[plt-scheme] reliable exit handlers for foreign functions
Is there any reliable way to register atexit callbacks with ffi?
I am trying to register a native thunk with atexit, but I am not getting
anywhere:
> (get-ffi-obj "atexit" #f _pointer)
ffi-obj: couldn't get "atexit" from #f (/usr/local/plt/bin/mzscheme:
undefined symbol: atexit)
Trying libc doesn't go very far either:
> (get-ffi-obj "atexit" "libc" _pointer)
ffi-lib: couldn't open "libc.so" (/usr/lib64/libc.so: invalid ELF header)
;; huh?
> (get-ffi-obj "atexit" "/lib/libc.so.6" _pointer)
ffi-obj: couldn't get "atexit" from "/lib/libc.so.6" (/lib/libc.so.6:
undefined symbol: atexit)
Any ideas? Is there anything equivalent at scheme side? (exit-handler
doesn't seem to get get called when I C-d the process)
-- vyzo