|
From: | Frank de Jong |
Subject: | Shared object using symbols from parent instead of their own? |
Date: | Sat, 28 Sep 2002 16:26:44 +0200 |
Hi, [I was told by someone from bug-binutils to ask this question here.] I am using a system where a number of shared objects export a similar symbol. One of the shared objects is a master which loads all the slaves, with dlopen(). Let's assume i am using a single slave shared object for now. In each shared object (master and all slaves), I have defined the global class "DllMainLoader", that simply calls the function DllMain() in its constructor. Basically, I am trying to port some (working) Windows DLLs work to Linux/g++, without messing with _init and _fini, for which I want to use the object initialization code that g++ supplies (crti.o). I've noticed something strange. When I dlopen() the master from a standalone binary, both master and slave call their OWN DllMain when they initialize their global symbols, but when I LINK the master object into the binary, the slave calls the master's DllMain (although it does initialize it's own DllMainLoader object). In fact, if in the slave, I try to access any global variables, the slave also finds variables in the master. I'm using the latest versions of gcc (3.2) and binutils. Is this a bug? Regards, Frank de Jong
Makefile
Description: Text document
link_so.cpp
Description: Text document
load_so.cpp
Description: Text document
master.cpp
Description: Text document
slave.cpp
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |