|
From: | Frank de Jong |
Subject: | address@hidden: Shared object using symbols from parent instead of their own?] |
Date: | Sat, 28 Sep 2002 00:48:35 +0200 |
Hi, I am using a system where a number of shared objects export a same-named 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. Here's my versions: gcc-3.2 binutils-2.13 Is this a bug? And how can I get all modules to call their own DllMainLoader, while still linking the master into the standalone binary? Please CC me on replies. 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] |