dbenoit17 / dynamic-ffi

Auto define Racket bindings to C by parsing header files.
Other
28 stars 10 forks source link

generate-static-ffi incorrectly generates ffi-lib call #30

Closed sorawee closed 4 years ago

sorawee commented 4 years ago

Consider:

(generate-static-ffi 'libfoo
 "libfoo.mapped-ffi.rkt" 
 (dynamic-ffi-lib "/path/to/libfoo.dylib")
 "/path/to/foo.h")

This will work fine. However, if we remove .dylib from the dynamic-ffi-lib path, an error will occur, saying that it could not find the shared library file.

The reason, apparently, is that generate-static-ffi will generate ffi-lib with (list ) as a version when dynamic-ffi-lib doesn't have any version strings. When a file extension is given in dynamic-ffi-lib, this is fine. However, when a file extension is not given, it is crucial that the version should be either left unspecified or #f.

sorawee commented 4 years ago

Ah, I can just specify "/path/to/libfoo" without using dynamic-ffi-lib. My bad. Closing...