Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

i forgot how to...

Name: Anonymous 2008-03-10 12:56

compile AND link a shared object using gcc /tl;dr

i have this program which dynamically loads modules, shared objects, for functionality, and so far i've used a Makefile that compiles in one rule, gcc, and links in another rule, ld

but now i just added a module that links to perl libs and i need to compile it EXACTLY like my perl interpreter, which was compiled AND linked using gcc, and i forgot how i do that

why isn't this working?
gcc -Wall -pedantic -ansi -DSETPROCTITLE -Isrc -I.. -rpath . -L. -L../.. -lbice -fPIC -shared -Wl,-soname,islam.so -o modules/islam.so -lc src/mods/islam.c

i get this error /var/tmp//ccr5zUiZ.o(.text+0xd0): In function `_init':
: multiple definition of `_init'
/usr/lib/crti.o(.init+0x0): first defined here


most modules don't have an _init function but some that need to load something into memory when dlopen is executed DO, and that's where the gmake process gets stuck, because of this weird crti.o thing, i used to compile and link using gcc but then i switched to two rules and now i don't remember how i did it or why this isn't working, no i don't need to link with crt0 or anything like that because i never did before

Name: Anonymous 2008-03-10 13:01

islam
what.

Name: Anonymous 2008-03-10 13:04

>>2
FUCK YEAH!

Name: Anonymous 2008-03-10 13:04

src/mods/sicp.c

Name: Anonymous 2008-03-10 13:10

#include <sys/lisp.h>

Name: Anonymous 2008-03-10 13:14

Don't export a symbol for your init function, duh.

For that matter, don't use init functions.  Use __attribute__((constructor)).

Name: Anonymous 2008-03-10 13:19

>>6
i had no idea those were obsolete, thanks for the heads up

i don't even remember where i learned about _init and _fini, probably the dlopen manuals on freebsd, i'm gonna use these constructors instead and this problem should be solved

Name: Anonymous 2009-03-06 7:49


modules loaded Parsec Parsec?

Name: Anonymous 2010-11-14 15:06

Don't change these.
Name: Email:
Entire Thread Thread List