[Ecls-list] Build-shared-library gives multiple definitions error

Goffioul Michael goffioul at imec.be
Mon Aug 7 12:44: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.
> I tested it with a simple hello world program, and it seems 
> the object file resulting from compile-file and the 
> intermediate file that c:build-shared-library create both 
> contains the symbol _init_ECL_HELLO.  I'm doing (compile-file 
> "ecl-hello" :system-p t) first, then (c:build-shared-library 
> "libecl-hello.dylib" :lisp-files
> '("ecl-hello")) --- am I doing this incorrectly?  Otherwise, 
> how might I fix this problem?  Thanks in advance for any input.

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


More information about the ecl-devel mailing list