From [1] I see the following code example
(*define-foreign-library* libcurl (:unix (:or "libcurl.so.3" "libcurl.so")) (t (:default "libcurl")))
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?
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?
Thanks.
[1]: http://common-lisp.net/project/cffi/manual/cffi-manual.html#Tutorial_002dLoa...
On Tue, Dec 31, 2013 at 6:58 PM, Elliott Slaughter elliottslaughter@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,
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@gmail.com javascript:;> 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/
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@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/
On Thu, Jan 2, 2014 at 1:46 PM, Luke Crook luke@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.
On Tuesday, December 31, 2013, Luís Oliveira wrote:
On Tue, Dec 31, 2013 at 6:58 PM, Elliott Slaughter elliottslaughter@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/
On Friday, January 3, 2014, Elliott Slaughter wrote:
On Thu, Jan 2, 2014 at 1:46 PM, Luke Crook <luke@balooga.com<javascript:_e({}, 'cvml', 'luke@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@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