Re: Question wrt interface to Allegro
"A.J. Rossini" <[email protected]> Wed, 10 Dec 2008 15:42:27 +0100
| Newsgroups | gmane.lisp.matlisp.user |
|---|---|
| Message-ID | <[email protected]> |
My "right answer" to the "wrong question" (that you didn't ask). If you don't mind the potential overhead of CFFI, take a look at the cl-blapack (works, for BLAS and LAPACK) and/or lisp-matrix packages (concepts and code) for Fortran linking with CFFI. On Wed, Dec 10, 2008 at 2:20 PM, Nicolas Neuss <[email protected]> wrote: > Hello, > > I have troubles with interfacing to Fortran using Allegro and I think that > maybe the experience of the people here might help me with this problem. > > The following code using SBCL works fine and returns sqrt(10). > > (sb-alien:load-shared-object #p"/usr/lib/libblas.so") > (SB-ALIEN:DEFINE-ALIEN-ROUTINE "dnrm2_" SB-ALIEN:DOUBLE > (N SB-ALIEN:INT :COPY) > (X (* SB-ALIEN:DOUBLE) :IN) > (INCX SB-ALIEN:INT :COPY)) > > (dnrm2- 10 (sb-sys:vector-sap > (make-array 10 :element-type 'double-float > :initial-element 1.0d0)) > 1) > > works fine. But when I try the same thing with Allegro (ACL 8.1, trial > edition), I get: > > CL-USER(1): (cl:load #p"/usr/lib/libblas.so") > > (foreign-functions:def-foreign-call (dnrm2- "dnrm2_") > ((n :int) (x (:array :double)) (incx :int)) > :convention :fortran > :returning :double) > > (dnrm2- 10 (make-array 10 :element-type 'double-float :initial-element 1.0d0) 1) > > ; Foreign loading /usr/lib/libblas.so. > T > CL-USER(2): CL-USER(2): DNRM2- > CL-USER(3): CL-USER(3): Error: Attempt to do an array operation on -269087380 which is not an > array. > [condition type: TYPE-ERROR] > > Restart actions (select using :continue): > 0: Return to Top Level (an "abort" restart). > 1: Abort entirely from this (lisp) process. > [1] CL-USER(4): :bt > Evaluation stack: > > DNRM2- <- > EVAL <- TPL:TOP-LEVEL-READ-EVAL-PRINT-LOOP <- > TPL:START-INTERACTIVE-TOP-LEVEL > > [1] CL-USER(5): :local > Interpreted lexical environment: > INCX: 1 > X: #(1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0) > N: 10 > Compiled lexical environment: > 0(REQUIRED): N: 10 > 1(REQUIRED): X: > #(1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0 1.0d0) > 2(REQUIRED): INCX: 1 > [1] CL-USER(6): > > Does anyone have an idea what happens here? > > Thanks, Nicolas > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. > The future of the web can't happen without you. Join us at MIX09 to help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > Matlisp-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matlisp-users > -- best, -tony [email protected] Muttenz, Switzerland. "Commit early,commit often, and commit in a repository from which we can easily roll-back your mistakes" (AJR, 4Jan05). Drink Coffee: Do stupid things faster with more energy! ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/