[cffi-devel] Recommended way to specify libraries

Luke Crook luke at balooga.com
Thu Jan 2 21:48:10 UTC 2014


Haha. I didn't notice that Elliot was the origin poster. Sorry about that
Elliot.

/Luke

On Thursday, January 2, 2014, Luke Crook wrote:

> I don't think that this is such a burden. This is how libs are loaded in
> lisp builder-sdl.
>
>
> (cffi:define-foreign-library sdl
>   (:darwin (:or (:framework "SDL")
>                 (:default "libSDL")))
>   (:windows "SDL.dll")
>   (:unix (:or "libSDL-1.2.so.0.7.2"
>               "libSDL-1.2.so.0"
>               "libSDL-1.2.so"
>               "libSDL.so"
>               "libSDL")))
>
>
> On Tuesday, December 31, 2013, Luís Oliveira wrote:
>
>> 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/
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20140102/783cc559/attachment.html>


More information about the cffi-devel mailing list