I am trying to call the Fortran routine dbspvd (calculates B-splines)
from the Slatec library. Its interface looks like this (more info at [1]):
SUBROUTINE DBSPVD (T, K, NDERIV, X, ILEFT, LDVNIK, VNIKX, WORK)
C Description of Arguments
C Input T,X are double precision
C T - knot vector of length N+K, where
C N = number of B-spline basis functions
C N = sum of knot multiplicities-K
C K - order of the B-spline, K .GE. 1
C NDERIV - number of derivatives = NDERIV-1,
C 1 .LE. NDERIV .LE. K
C X - argument of basis functions,
C T(K) .LE. X .LE. T(N+1)
C ILEFT - largest integer such that
C T(ILEFT) .LE. X .LT. T(ILEFT+1)
C LDVNIK - leading dimension of matrix VNIKX
C
C Output VNIKX,WORK are double precision
C VNIKX - matrix of dimension at least (K,NDERIV) contain-
C ing the nonzero basis functions at X and their
C derivatives columnwise.
C WORK - a work vector of length (K+1)*(K+2)/2
I have two questions:
1. AFAIK Fortran calls everything by reference, so I need to pass
pointers. Would the following be correct?
(alien:def-alien-routine "dbspvd_" c-call:void
(knots (* integer) :in) ; the knots
(k (* integer) :in) ; order of the spline
(nderiv (* integer) :in) ; number of derivatives to calculate
(x (* double-float) :in) ; x
(ileft (* integer) :in) ; interval index
(ldvnik (* integer) :in) ; leading dimension of the matrix
(usually k)
(vnikx (* double-float) :in) ; result goes here, dim: [k,nderiv]
(work (* double-float) :in)) ; work area, length: (k+1)*(k+2)/2
2. I have compliled the slatec libary and it loads correctly. But
when I complile he above code, CMUCL complains about Undefined foreign
symbol: "dbspvd_" [Condition of type KERNEL:SIMPLE-PROGRAM-ERROR]. Note that
$ nm -D /usr/local/lib/libslatec.so | grep dbspvd
0020b010 T dbspvd_
What I am doing wrong?
Thanks,
Tamas
[1] http://www.netlib.org/slatec/src/dbspvd.f