[Ecls-list] Build-shared-library gives multiple definitions error
Daniel Dickison
danieldickison at cmu.edu
Mon Aug 7 18:53:21 UTC 2006
>> I'm running ECL on Mac OS X 10.4.7 and having trouble with
>> the c:build-shared-library command. Specifically, the linker
>> (ld) fails because it encounters multiple definitions of the
>> _init_* routine.
>
> Do not use the same name for the object file and the target library.
> If your library only contains one file, then you can directly build
> a FASL file with COMPILE-FILE without the SYSTEM-P argument.
> Otherwise,
> either you have to use a different name for all object files and
> the target library, or you can use the variable
> SI::*INIT-FUNCTION-PREFIX* to avoid name clash:
> - set it to "HELLOLIB" when compiling your source files
> - set it to "" when creating your library
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.
Daniel
P.S. Sorry Michael -- I meant to reply to the list but sent it to you
so you'll get two copies.
More information about the ecl-devel
mailing list