[Ecls-list] embedding ecl in multi-threaded C?

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Tue Mar 10 08:51:37 UTC 2009

On Sun, Mar 8, 2009 at 6:09 AM, Ross Lonstein <rlonstein+ecls at pobox.com> wrote:
> That is I worked out my own mistakes. The vendor code does some
> interesting things (for one, it unloads the shared object after use;
> another it seems to use wrappers to malloc/free and the raw ones).
> Turning off ECL's handling of SIGSEGV via ecl_set_option() let me
> figure out how it failed (but not get a core, another feature).
> Looks like it's not going to play well.

Hi Ross, sorry for the late answer. I do not know whether I can help,
but let me try.

First of all, I assume you only all cl_boot() once. I seemed to
understand the opposite from your message.

Second, ECL's garbage collector only knows about the threads its
creates. There are functions to import already created threads (void
ecl_import_current_thread(cl_object name, cl_object bindings)) but
this one currently assumes the garbage collector already knows about
that thread. Getting a more recent version of the garbage collector
you will find a function to do it.

Third, it seems that your vendor code unloads ECL after using the
function? Have you thought about writing a wrapper that loads your
library and finds out the entry point every time it is needed. That
wrapper should not be linked with ECL so that when it is unloaded, the
library does not leave memory and continues to function.


Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28009 (Spain)

More information about the ecl-devel mailing list