[Ecls-list] Build-shared-library gives multiple definitionserror
Goffioul Michael
goffioul at imec.be
Tue Aug 8 08:46:04 UTC 2006
> Thanks for your help. I was able to get the library to
> compile by specifying different file names.
>
> But now I'm a bit confused. I was hoping to use the library
> in a C program which would load up the dynamically loaded
> library at runtime to provide functions that would be called
> from the main app. The DLL would have to set up the Lisp
> environment when loaded, and have exported functions which
> can be called from the C program.
>
> However, the c:build-shared-library appears to produces code
> assumes a running ECL environment, so it can't be used from a
> "plain" C program. Is this correct? And if so, is what I'm
> trying to do even possible? If it is, I'd greatly appreciate
> if you could point me to some documentation or tutorials on
> how to make shared libraries loadable from C programs.
The dynamic/static libraries won't init the ECL engine for you,
you'll have to do it yourself in your code, using cl_boot function.
Then you'll have to load your compiled library into the ECL engine:
each compiled lib defines a function called init_XXXXX (XXXX stands
for the module name); use this function with read_VV function as
read_VV(OBJNULL, init_XXXXXX);
This is what ECL does when loading a FASL file. After that, your
code can call LISP functions either by using eval() or by calling
directly the C equivalent.
Michael.
More information about the ecl-devel
mailing list