[Ecls-list] updating refererence pointers in UFFI

Dean O'Connor Dean.OConnor at ite.com.au
Wed Aug 30 05:58:41 UTC 2006

I may have asked his ages ago but can't seem to find any record of it.

I should probably post this on some UFFI mail list if I can find one
aswell, but any ideas with ECL.

I am using UFFI to call our DLL (written in C) functions and most of it
works ok.
I can pass cstrings ok as in cl_init().

But other functions such as cl_elementGetAttachment() creates C strings
and return them by assigning them to dereferenced argument pointers.
Also pointers to longs are dereferenced.
Eg. for the "attachment" argument, in C we pass the address of a C
string pointer. This get updated with the newly allocated C string

So is there any way to pass the C-function via UFFI a C pointer arg of
somekind and have it updated when returning to Lisp ??
It doesn't seem to fit in with the Lisp way of doing things, but is this
possible in any way ?

I am not compiling any of this in Windows. Its just pure interpretive.

long cl_init(const char *configFileName);

((ffi:def-function ("cl_init" init)
  ((configFileName :cstring ))
  :returning :long

long cl_elementGetAttachment(long hDoc, unsigned int index, char **name,
char **attachment, unsigned long *attachmentSize, bool detach);

((ffi:def-function ("cl_elementgetattachment" element-get-attachment)
                  ((hdoc :long) (index :unsigned-short) (name
                   (attachment :pointer-void) (attachmentsize
                   (detach :unsigned-char))


More information about the ecl-devel mailing list