[cffi-devel] Recommended way to specify libraries
Luke Crook
luke at balooga.com
Sat Jan 4 18:45:57 UTC 2014
On Friday, January 3, 2014, Elliott Slaughter wrote:
> On Thu, Jan 2, 2014 at 1:46 PM, Luke Crook <luke at balooga.com<javascript:_e({}, 'cvml', 'luke at balooga.com');>
> > 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")))
>>
>
> Yeah, we can keep doing that, but I did get some complaints recently from
> users who found a new libpng version we hadn't accounted for. And Windows
> has no tradition of maintaining multiple names for the same library, so we
> can't just assume it'll exist under the name "libpng.dll". I guess if we
> stick to our current system we'll just have to push patches every time a
> new libpng version is released.
>
Specifying the library names in a configuration file could be a solution.
The system could create such a file with defaults if one is not found so
that users don't have to guess the file format.
>
>> 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/
>>>
>>>
>
>
> --
> Elliott Slaughter
>
> "Don't worry about what anybody else is going to do. The best way to
> predict the future is to invent it." - Alan Kay
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20140104/45f0d1a0/attachment.html>
More information about the cffi-devel
mailing list