[Ecls-list] generated shared library does not contain the defined function

Juan Jose Garcia-Ripoll juanjose.garciaripoll at gmail.com
Sun May 19 21:08:20 UTC 2013


On Mon, May 13, 2013 at 12:33 PM, Ala'a Mohammad <amalawi at gmail.com> wrote:

> This is my first try at ECL, and need help in figuring out what is
> missing. I had tried googling for similar examples but did not found one
> that demoed what i wanted.
>

There are many examples out there how to call Common Lisp functions. Indeed
many in this very same mailing list explain how to call cl_boot(),
ecl_read_from_cstring(), cl_funcall() and friends. Directly calling a
Common Lisp function compiled by you by name is not recommended.


> (proclaim '(si::c-export-fname sum-arary))
>

In order to have compile-time side effects you need to fix the name and use
(eval-when (:compile-toplevel)
 (proclaim '(si::c-export-fname sum-array)))

  // summ-array
>   ////demo_sum_array  = dlsym(libhandle,"demo_sum_array");
>   demo_sum_array  = dlsym(libhandle,"L1sum_array");
>   if(demo_sum_array == NULL) {
>     /* ERROR HANDLING */
>     fprintf(stderr, "%s\n", dlerror());
>     exit(1);
>   }
>

Broken, broken, broken. ECL has to be bootstrapped before calling any
function. This involves a well defined protocol that starts by calling
cl_boot() with two arguments and, optionally, registering any additional
threads from which code may be invoked. Then you can start using Common
Lisp functions and objects.

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130519/2bb30135/attachment.html>


More information about the ecl-devel mailing list