Thanks, that works.
Now, how do you pass a string by address? Of course, the
documentation is very misleading. I tried the same thing on a
string but that did not work.
(ff:def-foreign-call test_string ((mesg (* :unsigned-byte) (simple-array simple-string (*))))
:returning :void)
Johannes Beck <informatik.uni-wuerzburg.de at beck> writes:
> Hi,
>
> > I am trying to call a c function with an argument passed by address.
> > Reading the documentation in
> > file:/usr/local/acl5/doc/cl/foreign_functions.htm#5.1,
> > Modifying arguments called by address: use arrays
> > I found the example:
> >
> > (ff:def-foreign-call `itimes2 ((simple-array fixnum (1)))
> > :convention :fortran :returning :void)
> >
> > However, changing the obvious mistakes to:
> >
> > (ff:def-foreign-call itimes2 ((dice (simple-array fixnum (1))))
> > :convention :c :returning :void)
> >
> > I get the error:
> >
> > Error: don't know how to convert type: (SIMPLE-ARRAY FIXNUM (1))
> > [condition type: SIMPLE-ERROR]
> IMO the given example has more mistakes than the ones you already
> detected. I think it should look like this (although I didnt test it):
>
> (ff:def-foreign-call itimes2
> ((dice ;;; Name of the
> Argument
> (* :unsigned-byte) ;;; The foreign
> argument is a
> ;;; pointer to some
> numbers
> (simple-array fixnum (1))) ;;; which should be
> converted to the
> ;;; LISP type
> simple-array of fixnum
> )
> :convention :c :returning :void)
>
> Hope that helps
> Joe
>
> --
> Johannes Beck beck at informatik.uni-wuerzburg.de
>
> PGP Public Key available by
> <www-info6.informatik.uni-wuerzburg.de at finger://beck>
>
--
myriam
Go Proverb:
In the corner, five stones in a row on the third line are alive.