[Ecls-list] Accessing C variables

Goffioul Michael goffioul at imec.be
Fri Sep 2 01:11:04 UTC 2005


> Hello,
> 
> Forgive me if this has been asked before or is obvious but I 
> cannot find 
> any clear (to me :) information on this anywhere. Any pointers in the 
> right direction would be appreciated.
> (I've been doing a refresher in Lisp to get this working ... 
> last time 
> was in Uni .... a looooong time ago)
> 
> We have a C++ application (for windows/linux) and we can boot ECL and 
> run scripts just fine.
> Our plan is use interpreted (prob not pre-compiled) Lisp scripts to 
> analyse data in the C++ apps memory and return basic decisions. 
> Basically rule scripts.
> 
> The C++ datastructures can be quite large, so I am trying to avoid 
> having to *copy* them into Lisp space.
> 
> Is there a way to point/bind to the existing C++ data 
> structures in Lisp 
> interpreter real time? So the Lisp scripts can understand and 
> read the data.
> The C++ structures could be classes, or structs, but could be 
> reduced to 
> more basic data-types.

You can have a look into the /contrib/win32/ directory of the ECL source
tree. Using FFI, there are LISP functions that manipulate Windows structure.

One way to pass a C object/structure to LISP is using the ecl_make_foreign_data
function.

Michael.




More information about the ecl-devel mailing list