[Insight-users] Static compilation of itk in different dynamic libs
Benoit.Bleuze at sophia.inria.fr
Benoit.Bleuze at sophia.inria.fr
Tue May 25 10:50:00 EDT 2010
Hi all,
I am experiencing some problems with the static linking of itk and the
use of the included gdcm.
Let's compile a static itk, then include it in 2 different libraries, in
my case they are then dynamically linked to a other third one in which
resides the executable. Call them libA and libB. Both use an
itkImageIOFactory at some point.
They work fine, until the application closes, and the program tries to
delete the gdcm::Global object internally used by the
itkGDCMImageIOFactory object which is created at instanciation time.
The fact that the libraries A and B are not aware of one an other
results in the fact that gdcm::Global is created two times, but the
constructor allocates the memory only once for the class variables in
Global. Obviously this crashes. This breaks the singleton pattern and I
expected an unexpected result. Is there a way to handle that situation
in itk? For instance, is there at least a way to not instanciate the
gdcm factory along with the others? We don't use gdcm to deal with dicom
images, and therefore woudn't mind getting rid of this factory.
Additional question: are there any other singleton classes that may
behave the same way and get me in trouble even further?
Thank you very much for your insight (no pun intented).
Benoît Bleuzé.
More information about the Insight-users
mailing list