From 6ba98a3c21d34a1f26770c8281a920c2266fa0ec Mon Sep 17 00:00:00 2001 From: malaterre Date: Sun, 9 Jan 2005 00:13:26 +0000 Subject: [PATCH] BUG: Solve -hopefully- problem on MacOSX where gdcm seemed to stop working. More detail in gdcmGlobal.cxx --- ChangeLog | 6 ++++++ src/gdcmCommon.h | 14 +++++++------- src/gdcmGlobal.cxx | 16 ++++++++++++++-- src/gdcmUtil.cxx | 6 ++---- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8633608d..bd615913 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-01-08 Mathieu Malaterre + * Fix bug on MacOSX with static initialization in a multui threaded + environement. static const string in a header file used to be ill + initialized provoquing the freeze of any tests. patch should solve this + issue. + 2005-01-08 Jean-Pierre Roux * According to Benoit's suggestion, and without any objection from anybody - methods SetxxxByNumber and GetxxxByNumber renamed as Setxxx and Getxxx diff --git a/src/gdcmCommon.h b/src/gdcmCommon.h index d9dab0a8..ee2ef9dd 100644 --- a/src/gdcmCommon.h +++ b/src/gdcmCommon.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmCommon.h,v $ Language: C++ - Date: $Date: 2005/01/08 23:14:05 $ - Version: $Revision: 1.45 $ + Date: $Date: 2005/01/09 00:13:26 $ + Version: $Revision: 1.46 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -78,11 +78,11 @@ namespace gdcm #define DICT_TS "dicomTS.dic" #define DICT_VR "dicomVR.dic" -static const std::string GDCM_UNKNOWN = "gdcm::Unknown"; -static const std::string GDCM_UNFOUND = "gdcm::Unfound"; -static const std::string GDCM_BINLOADED = "gdcm::Binary data loaded"; -static const std::string GDCM_NOTLOADED = "gdcm::NotLoaded"; -static const std::string GDCM_UNREAD = "gdcm::UnRead"; +extern const std::string GDCM_UNKNOWN; +extern const std::string GDCM_UNFOUND; +extern const std::string GDCM_BINLOADED; +extern const std::string GDCM_NOTLOADED; +extern const std::string GDCM_UNREAD; /// \brief TagKey is made to hold an "universal" (as in URL, Universal /// Ressource Locator) key to a DocEntry i.e. a dicom tag. diff --git a/src/gdcmGlobal.cxx b/src/gdcmGlobal.cxx index fdcb4181..e5597cb9 100644 --- a/src/gdcmGlobal.cxx +++ b/src/gdcmGlobal.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmGlobal.cxx,v $ Language: C++ - Date: $Date: 2005/01/07 22:03:30 $ - Version: $Revision: 1.10 $ + Date: $Date: 2005/01/09 00:13:26 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,6 +27,18 @@ namespace gdcm { +// Those global string that are return by reference everywhere in gdcm code +// used to be in gdcmCommon.h but due to a 'bug' in gcc/MacOSX +// you cannot have static initialization in a multithreaded environment +// since there is a lazy construction everything got skrew up somehow +// Therefore the actual initiliazation is done in a cxx file (avoid +// duplicated symbol), and an extern is used in gdcmCommon.h +const std::string GDCM_UNKNOWN = "gdcm::Unknown"; +const std::string GDCM_UNFOUND = "gdcm::Unfound"; +const std::string GDCM_BINLOADED = "gdcm::Binary data loaded"; +const std::string GDCM_NOTLOADED = "gdcm::NotLoaded"; +const std::string GDCM_UNREAD = "gdcm::UnRead"; + /** * \ingroup Globals * \brief Pointer to a container, holding _all_ the Dicom Dictionaries. diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index c56e707b..ccdb3cb4 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmUtil.cxx,v $ Language: C++ - Date: $Date: 2005/01/08 23:00:23 $ - Version: $Revision: 1.85 $ + Date: $Date: 2005/01/09 00:13:26 $ + Version: $Revision: 1.86 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -366,9 +366,7 @@ typedef BOOL(WINAPI * pSnmpExtensionInitEx) ( #endif #ifdef __APPLE__ - #include - #include #include #include -- 2.45.1