[cffi-devel] define-foreign-library behavior

hbabcockos1 at mac.com hbabcockos1 at mac.com
Sat May 13 19:01:18 UTC 2006


Hello,

On OS-X, this works:

(define-foreign-library libc
	(t (:default "libc")))
(use-foreign-library libc)

But this doesn't:

(define-foreign-library libc
	(t (:or "libc" "libc.so.6")))
(use-foreign-library libc)

This seems to be because load-foreign-library doesn't attempt to  
guess the appropriate suffix for the library name when used with :or.  
This is the documented behavior but it could be a little confusing  
since the second example appears to the naive (like me) to be a super- 
set of the first example.

Also:
(define-foreign-library libc
	(:unix (:or "libc.so.6"))
	(t (:default "libc")))
(use-foreign-library libc)

Doesn't work since OS-X is unix, but not linux. Maybe after failing  
on the specific case (i.e. unix), it could fall back to the general  
case?

I could try and provide patches for one or both of these behaviors if  
people think that this would be an improvement.

best,
-Hazen




More information about the cffi-devel mailing list