Mirko Vukovic schrieb:
On Mon, Feb 18, 2008 at 11:01 AM, Reini Urban wrote:
2008/2/17, Mirko Vukovic:
I am trying to build a dll for gsl. I want to link it to clisp.
I would suggest not to use a static clisp module, just use the FFI. This is much simplier, smaller and easier to test. See libsvm or matlab, or pari for a more optimized binding.
I want to do this for my gdi module also, but had no time yet. And we still have no header parser, which could construct the FFI binding automatically. cffi might be useful.
Reini, The reason why I need cffi is that I am trying to get nlisp to work on clisp+cygwin. And nlisp is using cffi. I have nlisp running at work on linux+sbcl, but my laptop has only cygwin.
$ cygcheck /bin/cyggsl-0.dll f:\cygwin\bin\cyggsl-0.dll f:\cygwin\lib\lapack\cygblas.dll
Are you sure you have /lib/lapack or /usr/lib/lapack added to your path?
I posted a message on the cffi mailing list, and Luis is helping me there.
I see. $ clisp -q (ASDF:OOS 'ASDF:LOAD-OP :ASDF-INSTALL) (ASDF-INSTALL:INSTALL :nlisp)
Oops... So I had to create a small patch http://sourceforge.net/tracker/index.php?func=detail&aid=1896345&gro...
nlisp.lisp: (cffi:define-foreign-library libgslcblas (:darwin "libgslcblas.dylib") (:unix (:or "cyggslcblas-0.dll" "libgslcblas.so.0" "libgslcblas.so")) ... (cffi:define-foreign-library libgsl (:darwin "libgsl.dylib") (:unix (:or "cyggsl-0.dll" "libgsl.so.0" "libgsl.so")) ... (cffi:define-foreign-library libsndfile (:darwin "libsndfile.dylib") (:unix (:or "cygsndfile-1.dll" "libsndfile.so.1" "libsndfile.so"))
Luís, cannot this be a bit simplified for :cygwin? I've always have to do this. "libsndfile.so.1" can be automatically translated to "cygsndfile-1.dll". Unfortunately :cygwin is no define-foreign-library target, just :unix.
nlisp-core.lisp: fixnum and double-float just name clisp types, no classes yet. This is just for cmucl/sbcl so far. CLHS does not require those. The clisp numeric classes are listed in the impnotes Chapter 4.4. (NUMBER, COMPLEX, REAL, FLOAT, RATIONAL, RATIO, INTEGER)
Now (ASDF:OOS 'ASDF:LOAD-OP :NLISP) prints tons of FFI::FOREIGN-LIBRARY-FUNCTION warnings, but works fine.
On Mon, Feb 18, 2008 at 1:52 PM, Reini Urban rurban@x-ray.at wrote:
Mirko Vukovic schrieb:
On Mon, Feb 18, 2008 at 11:01 AM, Reini Urban wrote:
2008/2/17, Mirko Vukovic:
I am trying to build a dll for gsl. I want to link it to clisp.
I would suggest not to use a static clisp module, just use the FFI. This is much simplier, smaller and easier to test. See libsvm or matlab, or pari for a more optimized binding.
I want to do this for my gdi module also, but had no time yet. And we still have no header parser, which could construct the FFI binding automatically. cffi might be useful.
Reini, The reason why I need cffi is that I am trying to get nlisp to work on clisp+cygwin. And nlisp is using cffi. I have nlisp running at work on linux+sbcl, but my laptop has only cygwin.
$ cygcheck /bin/cyggsl-0.dll f:\cygwin\bin\cyggsl-0.dll f:\cygwin\lib\lapack\cygblas.dll
Are you sure you have /lib/lapack or /usr/lib/lapack added to your path?
I posted a message on the cffi mailing list, and Luis is helping me there.
I see. $ clisp -q (ASDF:OOS 'ASDF:LOAD-OP :ASDF-INSTALL) (ASDF-INSTALL:INSTALL :nlisp)
Oops... So I had to create a small patch http://sourceforge.net/tracker/index.php?func=detail&aid=1896345&gro...
nlisp.lisp: (cffi:define-foreign-library libgslcblas (:darwin "libgslcblas.dylib") (:unix (:or "cyggslcblas-0.dll" "libgslcblas.so.0" "libgslcblas.so")) ... (cffi:define-foreign-library libgsl (:darwin "libgsl.dylib") (:unix (:or "cyggsl-0.dll" "libgsl.so.0" "libgsl.so")) ... (cffi:define-foreign-library libsndfile (:darwin "libsndfile.dylib") (:unix (:or "cygsndfile-1.dll" "libsndfile.so.1" "libsndfile.so"))
Luís, cannot this be a bit simplified for :cygwin? I've always have to do this. "libsndfile.so.1" can be automatically translated to "cygsndfile-1.dll". Unfortunately :cygwin is no define-foreign-library target, just :unix.
nlisp-core.lisp: fixnum and double-float just name clisp types, no classes yet. This is just for cmucl/sbcl so far. CLHS does not require those. The clisp numeric classes are listed in the impnotes Chapter 4.4. (NUMBER, COMPLEX, REAL, FLOAT, RATIONAL, RATIO, INTEGER)
Now (ASDF:OOS 'ASDF:LOAD-OP :NLISP) prints tons of FFI::FOREIGN-LIBRARY-FUNCTION warnings, but works fine. --
Reini Urban http://phpwiki.org/ http://murbreak.at/ http://helsinki.at/ http://spacemovie.mur.at/ _______________________________________________ cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
Reini,
I was using that your format as well.
You can see from Luis' post that he can load the library as well. I'll keep digging to see why I cannot link to it (even though I can probe it - meaning clisp can see it)
Thanks for your comments and help
Mirko
On 18/02/2008, Reini Urban rurban@x-ray.at wrote:
Luís, cannot this be a bit simplified for :cygwin? I've always have to do this. "libsndfile.so.1" can be automatically translated to "cygsndfile-1.dll". Unfortunately :cygwin is no define-foreign-library target, just :unix.
Maybe. Do all cygwin Lisps push :CYGWIN onto their *FEATURES* like CLISP?
Regarding the naming convention, I suppose we could add a library designator (or change :DEFAULT) that handles that. E.g.: (:lib "foo" 2) would translate to "libfoo.so.2", "libfoo.2.dylib", "cygfoo-2.dll", etc.
On Mon, Feb 18, 2008 at 5:18 PM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Reini Urban rurban@x-ray.at wrote:
Luís, cannot this be a bit simplified for :cygwin? I've always have to do this. "libsndfile.so.1" can be automatically translated to "cygsndfile-1.dll". Unfortunately :cygwin is no define-foreign-library target, just :unix.
Maybe. Do all cygwin Lisps push :CYGWIN onto their *FEATURES* like CLISP?
Regarding the naming convention, I suppose we could add a library designator (or change :DEFAULT) that handles that. E.g.: (:lib "foo" 2) would translate to "libfoo.so.2", "libfoo.2.dylib", "cygfoo-2.dll", etc.
-- Luís Oliveira http://student.dei.uc.pt/~lmoliv/
cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
As far as I know, clisp is the only lisp running on cygwin. I tried compiling sbcl, and that got me nowhere.
Mirko
2008/2/18, Luís Oliveira luismbo@gmail.com:
On 18/02/2008, Reini Urban rurban@x-ray.at wrote:
Luís, cannot this be a bit simplified for :cygwin? I've always have to do this. "libsndfile.so.1" can be automatically translated to "cygsndfile-1.dll". Unfortunately :cygwin is no define-foreign-library target, just :unix.
Maybe. Do all cygwin Lisps push :CYGWIN onto their *FEATURES* like CLISP?
So far there is only clisp on the horizon. cygwin packages exist, but not supported by cffi and so such feature symbols: scsh, bigloo, ecl, guile
gcl should theoretically work also, but I never tried that.
Regarding the naming convention, I suppose we could add a library designator (or change :DEFAULT) that handles that. E.g.: (:lib "foo" 2) would translate to "libfoo.so.2", "libfoo.2.dylib", "cygfoo-2.dll", etc.
Great!