When loading an image where a variable was set to a null foreign pointer, like:
(defvar null-ptr (ffi:unsigned-foreign-address 0))
access to null-ptr returns an invalid foreign pointer, instead of valid (as it was before the image was saved and stopped). Here's a sample code that demonstrates this problem:
| (asdf:operate 'asdf:load-op 'cffi)
| (asdf:operate 'asdf:load-op 'cffi-uffi-compat)
| (defvar my-null-ptr (ffi:unsigned-foreign-address 0))
| (format t "- Before loading image, null ptr is: ~A!~%" my-null-ptr)
| (ext:saveinitmem "test.exe"
| :init-function #'(lambda ()
| (format t "- After loading image, my-null-ptr yelds: ~A.~%"
| :NORC t
| :script t
| :executable t
| :quiet t)
The output I get when I run this code is (after the initial load messages),
| - Before loading image, null ptr is: #<FOREIGN-ADDRESS #x00000000>!
| - After loading image, my-null-ptr yelds: #<INVALID FOREIGN-ADDRESS
I believe there's no point in making such null references invalid, and it breaks several code using foreign functions.
Log in to post a comment.