[cffi-devel] Recommended way to specify libraries

Luís Oliveira loliveira at common-lisp.net
Tue Dec 31 20:00:09 UTC 2013


On Tue, Dec 31, 2013 at 6:58 PM, Elliott Slaughter
<elliottslaughter at gmail.com> wrote:
> with the comment "the define-foreign-library clause (t (:default "libcurl"))
> [...] will adapt to various operating systems".
>
> I'm wondering exactly how smart is this automatic handling?

Right now, it simply appends an extension like ".dll" or ".dylib". It
doesn't handle versions or anything like that.


> On Windows, for example, the conventions are not always followed so closely,
> and as a result I keep adding more special cases to my
> define-foreign-library clauses when users complain they can't load the
> libraries.
>
> For example, libpng might be png.dll or libpng.dll or libpng12.dll or
> libpng12-0.dll or libpng15-15.dll.
>
> Will I be required to maintain a list of all possible names for the rest of
> eternity or is there some better way to manage this situation?

Yeah, that sucks. I'm not aware of a better general solution. In some
cases, you might get away with searching for "*png*.dll" then loading
that using load-foreign-library, but I suppose you need to be careful
where you search.

HTH,

-- 
Luís Oliveira
http://kerno.org/~luis/



More information about the cffi-devel mailing list