static class members, shared libs and other vegetables
- From: "Maor Avni" <maor.avni@xxxxxxxxx>
- Date: 26 Mar 2007 16:47:35 -0700
Hi All,
I'm trying to create a quick-and-dirty solution to a problem one of
our customer requires: one of the libs in our product needs to be
instantiated two times. The problem is that it contains many static
members.
Of course changing the static members to be non-static is the best
solution, unfortunately the code base is pretty big, and this would
require a lot of resources, which, unsurprisingly, we don't have.
Our first solution was to compile all libraries to a second set of
libraries, and load the two sets separately. This solution worked on
Windows, and we successful created two instances of every static
member in the system.
The solution doesn't work on Linux, as static members for some reason
are shared across the libraries, although the libraries are loaded
dynamically at the start of the program. Checking the library instance
I can see that we have different handles, and global variables are not
shared between the instances. Alas, static members in the classes are
shared which eliminates the suggested solution.
One way to solve this issue is, naturally, putting the code behind one
namespace, compiling it, changing the namespace and compiling the code
again. Unfortunately, this solution is too costly to implement since
the project contains a large number of files that should be changed.
In addition, this solution will be disposed of in the near future as
the static variables are removed.
Is there a quicker and dirtier way to solve this issue? Maybe some
script or switch to compile all code under a single namespace.
I'm desperate.
Maor
.
- Follow-Ups:
- Re: static class members, shared libs and other vegetables
- From: Paul Pluzhnikov
- Re: static class members, shared libs and other vegetables
- Prev by Date: Re: windows .dll files and linux
- Next by Date: Re: static class members, shared libs and other vegetables
- Previous by thread: How to get rid of 'cd' before %prep in spec file
- Next by thread: Re: static class members, shared libs and other vegetables
- Index(es):
Relevant Pages
|
|