|
From: Nicolas N. <ne...@ma...> - 2008-12-10 13:38:39
|
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
|