From: ben
Subject: so much pain with clisp + FFI + library + return char*
Date: 
Message-ID: <73d81490.0310131316.6d407faa@posting.google.com>
Hi all,

- Here is what I am trying to do: 
Call a function in a library from CLISP using FFI, to complicate
things a bit, the return type is a char*.  A prototype of this lib
function is
char* clibfunc( char* );

Before I tried to do this library call, I went through the tutorial in
the implementation spec, (Their example is to call a simple C function
using FFI), it works. So my current problem has nothing to do with
package name or path.

- My First try,
I tried to make a CLISP module directly without a wrapper function. I
finished clisp-link create-module-set. I added the library file name
to the lib_files in the link.sh file. But "clisp-link add-module-set
... " wouldn't build.

- My second try
I wrote a C wrapper function to call the library function. I
successfully built everything. My debug code shows that the C wrapper
function is called and receives parameter correctly, but I am only
getting null point back from the library function.

Now I am stuck. I suspect the library file is not linked correctly.
Was anyone able to do FFI for a library function all.

any tips, sample code will be extremely helpful.

thanks

ben