[MINC-users] minc2, hdf5, and shared libraries

EJ Nikelski nikelski at bic.mni.mcgill.ca
Fri Aug 14 10:49:05 EDT 2009


Hi all,

    I'm currently dealing with a weird problem and could use some
suggestions.  Specifically, I'm working on an R extension which calls
a minc2 shared library, which, in turn, calls a shared hdf5 library
(yup, just like RMINC).  The problem that I'm seeing is that when I
unload the minc2 library (from R) after an IO call, R aborts with a
segfault.  Note that I'm working on OS X.

   Now, after some valgrind-ing, I found that HDF5 registers a
clean-up routine using an atexit() call, which gets called when my
minc2 extension library is unloaded.  IF the HDF5 shared library is
already unloaded when the extension library is unloaded, a jump is
made into oblivion.

   So I can see a few options here:
(1) keep the HDF5 library from unloading (not sure how to do this)
(2) go through the minc2 API code and try to keep the HDF5 library
from registering the atexit() clean-up function.  The HDF5 function
H5dont_atexit() exists for this purpose, however I'm not clear about
the repercussions of doing this, and am also unsure about where best
to call this function.
(3) map the minc2 and hdf5 libraries together, so that one cannot be
unloaded without the other.  I'm not sure what ./configure switches
might allow me to do this (if any).

Suggestions?

-Jim

-- 
=================================
Jim Nikelski, Ph.D.
Postdoctoral Research Fellow
Bloomfield Centre for Research in Aging
Lady Davis Institute for Medical Research
Sir Mortimer B. Davis - Jewish General Hospital
McGill University


More information about the MINC-users mailing list