Hi Thorsten,

hmm, this is not correct:

> (de pnorm_both ("X" "Y" "Z" "I" "J")
>     (! native `*LibRmath "pnorm_both" 1.0 (cons "X" 1.0) '("Y" (1.0 . 4))
> '("Z" (1.0 . 4)) "I" "J" ) )

"Z" is an argument to the function, so it is bound to some evaluated value.

But this value is ignored, because in

   '("Z" (1.0 . 4))

"Z" is a *return* value. Also, (1.0 . 4) makes no sense here. A structure
argument is

   '(Var (<size> . <returnSpec))

but 1.0 is no size (it is too big, something like 1000000) and 4 is no return
spec.


If you want to pass a buffer to receivea double (the double* in the C
signature), you would do:

   (use MyDouble
      (native `*LibRmath "pnorm_both" 1.0 ...
         '(MyDouble (8 . 1.0)) ... )
      ... do something with MyDouble ...)

(8 . 1.0) allocates 8 bytes on the stack, passes the pointer to the C function,
receives a double in this place, and stores it in the symbol MyDouble.

☺/ A!ex

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

Reply via email to