[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dynamic mod_perl & libperl.so (was Re: .so and .a libs, tcl, postgres = in over my head)



On 10 Jul 1998, Stephen Zander wrote:

> z.c:
> 
> #include <dlfcn.h>
> 
> int one (void) { return 1; }
> 
> int  main (void)
> {
> 	void *ptr;
> 	int (*func)(void);
> 
> 	ptr = dlopen ("/tmp/libz1.so", RTLD_LAZY);
> 	func = (int (*)(void)) dlsym (ptr, "z1");
> 	return (*func)();
> }
> 
> z1.c:
> 
> #include <dlfcn.h>
> 
> int two (void) { return 2; }
> 
> int z1 (void)
> {
> 	void *ptr = dlopen ("/tmp/libz2.so", RTLD_LAZY);
> 	int  (*func)(void) = (int (*)(void)) dlsym (ptr, "z2");
> 	return (*func)();
> }
> 
> z2.c:
> 
> int z2 (void) {	return two () + one (); }
> 
> Under Solaris, building z2.c as
> 
> 	gcc -shared -fpic -o libz2.so z2.so -L /tmp -lz1
> 
> is sufficient to get all the symbols resolved.  Under Linux, however,
> that still fails complaining
> 
> /tmp/z: error in loading shared libraries
> /tmp/libz2.so: undefined symbol: one

Can you run ld on all the produced binaries? AFAIK if linux is not
following an explicit linkage like that then it is a bug and should be
corrected - if a library declares it needs another then that should be
honored.

Actually, on closer examination - under linx you need to speically compile
the main program for it's symbols to be exported (I -think-) Try removing
the 'one' and see if it resolves two.

Jason


--  
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: