Implemented automatic accessor lookup for integer types, based on alien type size and CFFI keyword -> alien type mapping. * src/cffi-sbcl.lisp (define-type-mapping): new macro.
We were previously using :LONG, but that does not match the machine word size on some platforms, namely Windows. Bug reported by Anton Kovalenko.
Previously, it was returning an expression, acting like a macro. Thanks to Nathan Bird for spotting this bug
As of OSX 10.6.6, loading things like CoreFoundation on something other than the initial thread results in a crash. Implemented workaround on SBCL based on what CCL does upstream. Other Lisps might benefit from similar workarounds.
Patch courtesy of Greg Pfeil. Closes lp:622272.
In grovel file, write: (bitfield flags-ctype ((:flag-a "FLAG_A") :documentation "DOCU_A") ((:flag-b "FLAG_B") :documentation "DOCU_B") ((:flag-c "FLAG_C") :documentation "DOCU_C")) And if the C header file has: #define FLAG_A 1 #define FLAG_B 2 #define FLAG_C 4 This will generate: (cffi:defbitfield (flags-ctype) (:flag-a 1) (:flag-b 2) (:flag-c 4))
Patch courtesy of Juan Jose Garcia-Ripoll.
- Added tests: FOREIGN-GLOBALS.UNDEFINED.1 and FOREIGN-GLOBALS.ERROR.1. - Check that FOREIGN-SYMBOL-POINTER's 'name' arg is a string.
RELOAD-FOREIGN-LIBRARIES &KEY (TEST #'FOREIGN-LIBRARY-LOADED-P) Useful especially when saving an image to reload libraries when the image is re-started. Pushing #'CFFI:RELOAD-FOREIGN-LIBRARIES to the implementation's *INIT-HOOKS*(or equivalent) should suffice for most cases
Add tests too
Don't use -fPIC on those systems
* add a PRINT-OBJECT method for foreign libraries * signal FOREIGN-LIBRARY-UNDEFINED-ERROR instead of a SIMPLE-ERROR in LOAD-FOREIGN-LIBRARY * keep around the library name used for opening, add reader FOREIGN-LIBRARY-NAME
If a library is dependen upon by another one loaded in the image, then CCL:CLOSE-SHARED-LIBRARY will end up in an endless loop, because it tries to repeatedly call dlclose() until it succeeds
Patch courtesy of Gustavo Milare.