[Ecls-list] Re: cl_def_c_function()

Michael O'Connor moconnor59 at yahoo.com
Thu Mar 11 14:46:00 UTC 2004


Julian Stecklina asked: I am interested what you need
that for. Could you please elaborate?

The C++ application I'm working on iterates over a set
of data and calls the interpreter to implement logic
and rules (written in Lisp) that apply to the data.
The Lisp code will be making callbacks to the
application to read various bits of data, and also to
return a result to the application for each dataset.

I'd like to write a single library module in the
application that handles things like translating C/C++
variables to / from cl_object instances (which will
need to be called for every argument and return-value
in each Lisp / C++ function call). Ideally the C++
code outside the library doesn't need to know anything
about Lisp variables (cl_object), they would just pass
ints, strings, etc. as usual to the library which
would perform the translation transparently.

However the callback funtion passed to
cl_def_c_function() has to uniquely identify the C
function that it's intending to call, and this is
where the problem occurs. I'm trying to write a
generic library routine that will behave as an
intermediate callback function to do the translation
etc., but this isn't possible without the library
routine storing some state data to help indicate the
actual callback function that needs to be called,
hence my original question.

Michael

--- Michael O'Connor <moconnor59 at yahoo.com> wrote:
> Quick question (I hope): does ECL support the idea
> of
> "client callback data"? By this I mean a C void
> pointer (void *) or similar that can be used to
> store
> / refer to context data in calls to the C/C++
> application.
> 
> This pointer would probably be passed into the call
> to
> cl_def_c_function() and would be returned to the
> C/C++
> application when Lisp calls the C function.
> 
> I hope that makes sense.
> 
> Thanks,
> 
> Michael
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what you’re looking for faster
> http://search.yahoo.com
> 


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com




More information about the ecl-devel mailing list