From: Raymond T. <ray...@er...> - 2008-12-10 17:21:21
|
>>>>> "Nicolas" == Nicolas Neuss <ne...@ma...> writes: Nicolas> Comparing with Matlisp, I have found my bug. Nicolas> Nicolas Neuss <ne...@ma...> writes: >> (foreign-functions:def-foreign-call (dnrm2- "dnrm2_") Nicolas> "dnrm2" is correct >> ((n :int) (x (:array :double)) (incx :int)) >> :convention :fortran >> :returning :double) Nicolas> To make sure I understand this correctly: dnrm2_ is probably a routine Nicolas> suitable for calling from C (passing arrays as a pointer to values) while Nicolas> Allegro with convention :fortran passes arrays pointing to values-1 as is Nicolas> suitable for the Fortran "dnrm2". I don't know what the :fortran convention means, but your explanation sounds plausible. It seems a little odd to me. For n and incx, I can see the :fortran convention to mean pass the address of the location of n and incx to the routine, since that's what Fortran does (everything is pass by reference). Arrays are a bit trickier. I don't see why you want to pass the address of x-1 instead of just x. After all, Fortran x(1) is the first element of the array, however that array might be arranged in memory. Ray |