Hi Thorsten,

> libblas.so is on my machine, the C function "idamax_" is found,which is
> actually a C wrapper for Fortran Code.
> In the Fortran docs, the parameters are described exactly, see below.

Hmm, the signature of the C function would be more helpful, as we want to call
it, and it should be exactly what needs to be known ;)

But let's first fix the more obvious issues:

   (de idamax ()
      (use "N" "Dx" "Incx"

If more than one symbol to 'use', you need to pass a list

      (use ("N" "Dx" "Incx")

Will not change the result though, just does not bind the symbols.

BTW, there is absolutely no need to put all these symbols into transient scope.


         (native `*LibBlas "idamax_" 'I
            '("N" (4 . 'I) 3)

The quote before the 'I' is wrong, because (4 ...) is not evaluated. (4 . I)
will return an integer in "N", so it corresponds to 'int* n;' in C.

The '3' is probaly also wrong. It initializes the 4-byte area with a *single*
byte, so it depends on the endianess of the machine what it actually means,
and leaves the other three bytes uninitialized.


            '("Dx" (8 . 1.0) '(1.0 1 2 3))

(8 . 1.0) may be good, meaning "double *dx;". The following initialization
'(1.0 1 2 3) is fatal, as it initializes the 8 bytes of the memory with three 
double
numbers. In addition, 1 2 and 3 are not double numbers.

Something like '("Dx" (24 . 1.0) '(1.0 1.0 2.0 3.0)) could make sense, if the C
argument is "double dx[3];".


            '("Incx" (4 . 'I) 0) )

Again, the quote is wrong. And it initializes the 4 bytes of the
integer only with a single zero byte.


         (list "N" "Dx" "Incx") ) )

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to