[Ecls-list] Newbie get/set question

David Creelman dave at geko.net.au
Sun Nov 20 17:30:13 UTC 2005


Hi Juan,

Okay, cool.

.. So I get back a cl_object from cl_[safe]eval. If I want to read an
integer, do I just read big from the cl_object ?

Cheers
DC

On Fri, 2005-11-18 at 11:04 +0100, Juan Jose Garcia Ripoll wrote:
> On Fri, 2005-11-18 at 18:57 +1100, David Creelman wrote:
> > I can run scripts/functions, but it's not clear to me how I get a
> > variable from ECL over to C/C++. There is mention of ffi:, but I don't
> > quite get that. Any pointers would be appreciated.
> 
> You can
> 
> 1) Get the output directy from cl_eval() if there is a single lisp
> statement.
> 
> 2) You can, in compiled files, access C variables using FFI. The value
> of this C variable can be set to whatever your lisp code wants to
> output. I find this, however, overkilling.
> 
> 3) You can simply define a special variable and assign it the value you
> want. To recover this value from C there are multiple possibilities.
> Perhaps the simplest (but not the safest one) is to use
> 
> 	c_string_to_object("thepackage::*thevariable*")
> 
> which will read the string and evaluate the symbol *thevariable* from
> the package "THEPACKAGE" and return the value. Formerly you might have
> done something like
> 
> 	(in-package :thepackage)
> 
> 	(setf *thevariable* (+ 1 1))
> 
> Have fun,
> 
> 
> Juanjo
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
> Register for a JBoss Training Course.  Free Certification Exam
> for All Training Attendees Through End of 2005. For more info visit:
> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
-- 
David Creelman
GPG: 11CC 0D54 D37A 4B9C 5C65  AB63 5B18 7F99 7D77 9CA5




More information about the ecl-devel mailing list