At 14:57 13.06.97, you wrote:
>Ok Charlie, I appreciate the reply. May I ask how you do this?
>(I am still trying to get up to speed on ACL) can you send me
>a code fragment that does it? I guess as follows, but I dont
>know, and I hate to have the C guys change the DLL for me if
>this is not what you mean...
>
>void add_doubles ( double x, double y, double *result )
>{
> *result = x + y;
>}
>
>
>(ct:defun-dll add_doubles ((x :double) (y :double) (res (:double *))
> :return-type :void
> :library-name *cmt-library*
> :entry-name "add_doubles")
>
>(setq a 5.60 b 7.80 c 0.0)
>-> 0.0
>
>(add_doubles a b c)
>-> NIL
>
>c
>-> 13.4
>
>Is that it?
>
>Thanks for any help you can give...
>
Hi,
you are on the right track try the following solution (because double as
return-value is not allowed in ACL ). It works within our ODBC-Interface.
void add_doubles ( double x, double y, double *result )
{
*result = x + y;
}
(ct:defun-dll add_doubles ((x :double-float) (y :double-float) (res
(:double-float *))
:return-type :void
:library-name *cmt-library*
:entry-name "add_doubles")
(defun add-doubles (x y)
(let ((return-double (ct:ccallocate (:double-float 1)))) ;; memory for
return value
(add_doubles x y return-double) ;; call
c-function
(ct:cref (:double-float 1) return-double 0) ;; read value
from memeory
)
)
(add-doubles 1.2 2.4) -> 3.6