[Ecls-list] Simple example needed for embedding in non-c like environment ...

Marten Feldtmann itlists at schrievkrom.de
Fri Aug 5 11:43:18 UTC 2011


Hello,

I'm new to this list (and new to Lisp) and I just wanted to try to call 
ECL from VASmalltalk - all I want to execute here
is stuff like (posted 2009 on this list):

int main(int argc, char **argv)
{
         cl_object form, result;
         cl_object princed;
         cl_object g_eclEvalErrorSymbol;

         cl_boot(argc, argv);

         form = c_string_to_object("(+ 1 1)");

         result = si_safe_eval(3, form, Cnil, g_eclEvalErrorSymbol);
         princed = cl_princ_to_string(1, result);
         printf("output: %s\n",(char *)princed->base_string.self);

         cl_shutdown();
         return (0);
}

but I have several problems here:

* first I have only the DLL available, therefore I can not use macros, but
   only exported functions from ecl.dll

* cl_princ_to_string(1, result) has only one argument and NOT two

* how can I get the result "2" as a string via function calls

what I have done so far is executing code (ok, from smalltalk to ecl) like:

cl_boot(argc, argv);
result = si_safe_eval(3, ecl_make_simple_base_string("(+ 1 1)",-1), Cnil, OBJNULL);
char* myString = ecl_base_string_pointer_safe(si_copy_to_simple_base_string(cl_princ_to_string(result)))
cl_shutdown();

and the content of myString is then: "(+ 1 1)", but I would like to get "2" ...... :-(

and two other problems/questions I have:

* where is the cl_object definition located .... seems to be strange for you,
   but I was not able to find the location of the definition

* when trying to create ecl under Windows - my anti virus software named
   antivir complains, that the newly created dpp.exe has a virus. Therefore
   I have to turn off the antivirus software, create the stuff and then
   turn it on again.






More information about the ecl-devel mailing list