[Insight-users] dynamic loader + GDCM

Stefan Klein stefan at isi.uu.nl
Mon Sep 12 10:00:05 EDT 2005


Hello,

We have a problem with using the itkDynamicLoader in combination with the 
GDCM library.

A little test program is attached to this email.
In the main function (defined in amain.cxx), we are trying to load a 
dynamic library at runtime. In the attached example this library is called 
"libadll.so". In this library one function is defined, called "afunc", 
which does nothing more than printing some stuff to the screen and creating 
an instance of the GDCMImageIO class. After calling 'afunc' from the lib 
the main program also creates an instance of the GDCMImageIO class. No 
errors occur until this moment, but when closing the program a SEGMENTATION 
FAULT is generated.

The problem does not occur with other imageIO classes.

We use:
GCC 3.4.2 on a 64bit linux system (AMD opteron).
ITK 2.2, compiled with CMAKE_C_FLAGS and CMAKE_CXX_FLAGS set to -fPIC. This 
is necessary, otherwise the program does not compile at all.

With ITK 2.0 an other error is given on exiting:
*** glibc detected *** double free or corruption (!prev): 
0x000000000061d0e0 ***

Any ideas on what the problem is in the GDCM library?  Can anybody 
reproduce this error?

Apart from this problem with the GDCM library, we noticed that the 
::LastError() function in the itk::DynamicLoader does not work at all. It 
produces a segmentation fault.

Thanks in advance,

Marius Staring and Stefan Klein.

-------------- next part --------------
PROJECT(testDLL)

# Find ITK.
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
          "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)

ADD_LIBRARY(adll MODULE adll.cxx)
TARGET_LINK_LIBRARIES(adll ITKCommon ITKIO  )

ADD_EXECUTABLE(amain amain.cxx )
TARGET_LINK_LIBRARIES(amain ITKCommon ITKIO)

INSTALL_TARGETS(/. adll amain)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: adll.cxx
Type: application/octet-stream
Size: 512 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20050912/048a8eac/adll.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: amain.cxx
Type: application/octet-stream
Size: 1715 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20050912/048a8eac/amain.obj
-------------- next part --------------



More information about the Insight-users mailing list