[vtkusers] vtkDynamicLoader::CloseLibrary bug?

Evan Daniel evanbd at gmail.com
Thu Jul 1 14:45:39 EDT 2004


I think that vtkDynamicLoader::CloseLibrary misbehaves on UNIX/Linux,
cvs version of VTK.

>From the vtk documentation:
 int vtkDynamicLoader::CloseLibrary  	(vtkLibHandle)   	 [static]
Attempt to detach a dynamic library from the process. A value of true
is returned if it is successful.

>From man 3 dlclose:
dlclose returns 0 on success, and non-zero on error.

The code:

int vtkDynamicLoader::CloseLibrary(vtkLibHandle lib)
{
  return (int)dlclose(lib);
}

This seems to be in error;  the patch below fixes it.

Evan Daniel


Index: Common/vtkDynamicLoader.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Common/vtkDynamicLoader.cxx,v
retrieving revision 1.18
diff -u -r1.18 vtkDynamicLoader.cxx
--- Common/vtkDynamicLoader.cxx       17 Feb 2004 20:31:01 -0000      1.18
+++ Common/vtkDynamicLoader.cxx       1 Jul 2004 18:42:59 -0000
@@ -237,7 +237,7 @@
 
 int vtkDynamicLoader::CloseLibrary(vtkLibHandle lib)
 {
-  return (int)dlclose(lib);
+  return !((int)dlclose(lib));
 }
 
 void* vtkDynamicLoader::GetSymbolAddress(vtkLibHandle lib, const char* sym)



More information about the vtkusers mailing list