[Ecls-list] interfacing to c libraries

Juan Jose Garcia-Ripoll jlr at mpq.mpg.de
Mon Nov 4 06:23:02 UTC 2002


Sorry I did not answer before, but I was in San Francisco.

On Monday 28 October 2002 06:17, dennis at illusions.com wrote:
> is it documented somewhere how to link to and call C libraries from ECL?
> For instance I want to use LDAP from ECL. I've got the openldap libraries
> libldap.a and libldap.so.
> Could I load libldap.so dynamically & call functions defined in it? If so,
> how?

Currently, there is no way to open a DLL and call arbitrary functions from it. 
The only documented way consists on compiling a lisp extension to C, linking 
this extension with your DLL and loading it.

You can read the section "Embedding C code in lisp source" in the developers 
manual (http://ecls.sourceforge.net/ecldev.html). There you find simple ways 
to define wrappers. The ECL compiler can generate wrappers for functions with 
simple arguments (char, int, float, double). For other types you have to make 
use of DEFCBODY and type the conversion yourself.

I admit that the FFI is an area which requires a lot of improvement :-(

Juanjo

-- 
Max-Planck-Institut fuer Quantenoptik	+49/089/32905-127
Hans-Kopfermann-Str. 1, D-85748		www.arrakis.es/~worm
Garching b. Muenchen, Germany		worm at arrakis.es






More information about the ecl-devel mailing list