-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving core images with variables bound to the result of require-namespace
does not work.
#78
Comments
I'll link to the related, great project of kat-co, used for cl-apache-arrow: https://github.com/kat-co/gir2cl
|
In case of SBCL a hook |
This makes a lot of sense, and I was hoping it would solve my issue, but unfortunately despite some tinkering, I can't seem to get it to work. Here's a small reproducible test-case: /tmp/experiment.lisp: (asdf:load-system :cffi)
(asdf:load-system :cl-gobject-introspection)
(defparameter *ns* (gir:require-namespace "Arrow"))
(defun bug-p ()
(format t "Foreign libraries loaded before call:~%~a~%" (cffi:list-foreign-libraries))
(gir:invoke (*ns* "BooleanDataType" "new"))
(format t "Foreign libraries loaded after call:~%~a~%" (cffi:list-foreign-libraries)))
(pushnew
(lambda ()
(format t "Loading libraries...~%")
(mapcar #'cffi:load-foreign-library
(list "libgirepository-1.0.so"
"libgobject-2.0.so")))
sb-ext:*init-hooks*)
(pushnew
(lambda ()
(let ((foreign-libs (cffi:list-foreign-libraries)))
(format t "Libraries loaded when dumped:~%~a~%" foreign-libs)
(loop for lib in foreign-libs
do (cffi:close-foreign-library lib))))
sb-ext:*save-hooks*)
(sb-ext:save-lisp-and-die "bug-p" :toplevel #'bug-p :executable t)
In my production code, I'm using I'm still not sure if this is an issue with |
If I place this within a pre-image-dump hook: (setf gir::*namespace-cache* (make-hash-table :test 'equal)) and then this in an image restore hook: (setf *ns* (gir:require-namespace "Arrow")) things work as expected. So I think it has something to do with the namespace cache not working across image persists? |
I was wondering if anyone could shed some light on why this is occurring. I am using SBCL v2.0.0.
If I load a REPL, and do this
(defparameter *ns* (gir:require-namespace "Arrow"))
, everything works as intended.If I do
(asdf:make :my-system)
(i.e. save-lis-and-die) on a system which utilizescl-apache-arrow
, all operations involving that*ns*
parameter fail with something like:If I replace all instances of
*ns*
with(gir:require-namespace "Arrow")
, everything works as expected again. Something is not surviving the persistence of the core, and I was hoping someone more familiar with the internals of this library would know what.cc kat-co/cl-apache-arrow#5
The text was updated successfully, but these errors were encountered: