sedj
Programmer
- Aug 6, 2002
- 5,610
Hi,
This is a little complicated, so please bear with me.
I have two DLLs, and a (common) static library (LIB).
Each DLL is linked statically to the "common" lib.
Within the static lib, there is a class which has a few static member variables, and a static method.
I also have a binary, that, depending on the input, will call one of the DLLs, which in turn will call the static class method in the "common" lib.
the code is also cross-platform, and when compiled in Linux I am seeing different behaviour in respect to the static variables.
In Linux, each of these DLLs, and the "common" lib are compiled as Shared Objects - with the two *DLL* type shared objects linking to the single compiled "common" shared object (or lib in Win32 land).
In Linux, there is only one instance of the static member variables - but in Win32 there are two (one for each of the static libs linked to the DLL).
Now I understand why this is the case in Win32, but I have no idea how to get the same behaviour in Win32 as I do in Linux - in effect having only one static instance of this "common" class's variables.
The classes in the "common" lib do not export their functions as you would in a DLL, and I do not wish to actually do this - so I cannot compile the "common" library as a DLL.
Has anybody any idea how I can achieve having only one instance of static members within the process and called DLLs (without a coding work-around and passing in the various bits and bobs via the DLL functions) ?
In Win32, I am using Visual Studio 2003. All code is a mixture of pure C and C++ (ie no .NET / managed C++ etc).
Here's hoping !
Cheers
--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
This is a little complicated, so please bear with me.
I have two DLLs, and a (common) static library (LIB).
Each DLL is linked statically to the "common" lib.
Within the static lib, there is a class which has a few static member variables, and a static method.
I also have a binary, that, depending on the input, will call one of the DLLs, which in turn will call the static class method in the "common" lib.
the code is also cross-platform, and when compiled in Linux I am seeing different behaviour in respect to the static variables.
In Linux, each of these DLLs, and the "common" lib are compiled as Shared Objects - with the two *DLL* type shared objects linking to the single compiled "common" shared object (or lib in Win32 land).
In Linux, there is only one instance of the static member variables - but in Win32 there are two (one for each of the static libs linked to the DLL).
Now I understand why this is the case in Win32, but I have no idea how to get the same behaviour in Win32 as I do in Linux - in effect having only one static instance of this "common" class's variables.
The classes in the "common" lib do not export their functions as you would in a DLL, and I do not wish to actually do this - so I cannot compile the "common" library as a DLL.
Has anybody any idea how I can achieve having only one instance of static members within the process and called DLLs (without a coding work-around and passing in the various bits and bobs via the DLL functions) ?
In Win32, I am using Visual Studio 2003. All code is a mixture of pure C and C++ (ie no .NET / managed C++ etc).
Here's hoping !
Cheers
--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software