From 54b86a169f110dcda8804b91503be21c96b13299 Mon Sep 17 00:00:00 2001 From: Michael Wild Date: Tue, 12 Apr 2011 18:39:01 +0200 Subject: [PATCH] FIX: Static init issues with argList.C and dlLibraryTable.C Signed-off-by: Michael Wild --- src/OpenFOAM/CMakeLists.txt | 2 +- src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C | 14 +++++-------- src/OpenFOAM/files.cmake | 11 ---------- src/OpenFOAM/global/global.C.in | 27 +++++++++++++++---------- 4 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/OpenFOAM/CMakeLists.txt b/src/OpenFOAM/CMakeLists.txt index 5e813f15c..a2fdfef9b 100644 --- a/src/OpenFOAM/CMakeLists.txt +++ b/src/OpenFOAM/CMakeLists.txt @@ -31,7 +31,7 @@ configure_file(global/global.C.in ${CMAKE_CURRENT_BINARY_DIR}/global/global.C @ONLY) -include_directories(${ZLIB_INCLUDE_DIR}) +include_directories(${ZLIB_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}") foam_add_library(OpenFOAM) diff --git a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C index 40fc9b3b5..107ce7cb8 100644 --- a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C @@ -96,19 +96,15 @@ bool Foam::dlLibraryTable::open(const fileName& functionLibName) dlopen(functionLibPath.c_str(), RTLD_LAZY|RTLD_GLOBAL); } #endif - // if successfully loaded, stop searching and display some info. - // have to use std::cout here, because Foam::Info might not be - // initialized here (I HATE STATIC INIT ORDER ISSUES!) and - // the C++ standard guarantees that std::cout is initialized - // before any static init from the user-side happens. + // if successfully loaded, stop searching and display some info if (functionLibPtr) { - std::cout << "Loaded " << functionLibName; + Info<< "Loaded " << functionLibName; if (pathI->empty()) - std::cout << " from the default search path"; + Info<< " from the default search path"; else - std::cout << " from " << functionLibPath; - std::cout << std::endl; + Info<< " from " << functionLibPath; + Info<< endl; break; } } diff --git a/src/OpenFOAM/files.cmake b/src/OpenFOAM/files.cmake index cea27ffc7..05fdbc4ab 100644 --- a/src/OpenFOAM/files.cmake +++ b/src/OpenFOAM/files.cmake @@ -32,7 +32,6 @@ set(SRCS ${CMAKE_CURRENT_BINARY_DIR}/global/global.C global/dimensionedConstants/dimensionedConstants.C - global/argList/argList.C global/clock/clock.C primitives/bools/bool/bool.C primitives/bools/bool/boolIO.C @@ -504,7 +503,6 @@ set(HDRS db/IOobjects/IOdictionary/IOdictionary.H db/IOstreams/Fstreams/IFstream.H db/IOstreams/Fstreams/OFstream.H - db/IOstreams/IOstreams.C db/IOstreams/IOstreams.H db/IOstreams/IOstreams/INew.H db/IOstreams/IOstreams/IOmanip.H @@ -519,7 +517,6 @@ set(HDRS db/IOstreams/Pstreams/Pstream.H db/IOstreams/Pstreams/PstreamCombineReduceOps.H db/IOstreams/Pstreams/PstreamImpl.H - db/IOstreams/Pstreams/PstreamImpl.C db/IOstreams/Pstreams/PstreamImplI.H db/IOstreams/Pstreams/PstreamReduceOps.H db/IOstreams/Pstreams/combineGatherScatter.C @@ -539,7 +536,6 @@ set(HDRS db/IOstreams/gzstream/gzstream.h db/IOstreams/hashes/OSHA1stream.H db/IOstreams/token/CompoundToken.H - db/IOstreams/token/token.C db/IOstreams/token/token.H db/IOstreams/token/tokenI.H db/IOstreams/token/tokenList.H @@ -563,12 +559,9 @@ set(HDRS db/dictionary/primitiveEntry/primitiveEntryTemplates.C db/dlLibraryTable/dlLibraryTable.H db/dlLibraryTable/dlLibraryTableTemplates.C - db/error/IOerror.C db/error/StaticAssert.H - db/error/error.C db/error/error.H db/error/errorManip.H - db/error/messageStream.C db/error/messageStream.H db/functionObjects/IOOutputFilter/IOOutputFilter.C db/functionObjects/IOOutputFilter/IOOutputFilter.H @@ -780,16 +773,13 @@ set(HDRS fields/pointPatchFields/pointPatchField/pointPatchFieldMapperPatchRef.H fields/pointPatchFields/pointPatchField/pointPatchFields.H fields/pointPatchFields/pointPatchField/pointPatchFieldsFwd.H - global/JobInfo/JobInfo.C global/JobInfo/JobInfo.H global/argList/argList.H global/argList/parRun.H global/clock/clock.H - global/debug/debug.C global/debug/debug.H global/dimensionedConstants/dimensionedConstants.H global/foamVersion.H - global/new.C graph/curve/curve.H graph/curve/curveTools.C graph/curve/curveTools.H @@ -926,7 +916,6 @@ set(HDRS meshes/meshShapes/cellModel/cellModel.H meshes/meshShapes/cellModel/cellModelI.H meshes/meshShapes/cellModeller/cellModeller.H - meshes/meshShapes/cellModeller/globalCellModeller.C meshes/meshShapes/cellShape/cellShape.H meshes/meshShapes/cellShape/cellShapeI.H meshes/meshShapes/cellShape/cellShapeIOList.H diff --git a/src/OpenFOAM/global/global.C.in b/src/OpenFOAM/global/global.C.in index eab51dc9c..2bac9b968 100644 --- a/src/OpenFOAM/global/global.C.in +++ b/src/OpenFOAM/global/global.C.in @@ -42,44 +42,49 @@ const char* const Foam::FOAMbuild = "@FOAM_BUILD_NUMBER@"; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Setup an error handler for the global new operator -#include +#include "global/new.C" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Global IO streams -#include +#include "db/IOstreams/IOstreams.C" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include +#include "global/JobInfo/JobInfo.H" bool Foam::JobInfo::constructed(false); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Global error definitions (initialised by construction) -#include -#include -#include -#include +#include "db/error//messageStream.C" +#include "db/error/error.C" +#include "db/error/IOerror.C" +#include "db/IOstreams/token/token.C" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Read the debug and info switches -#include +#include "global/debug/debug.C" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Dynamic Pstream loading (requiring debug::controlDict()) -#include +#include "db/IOstreams/Pstreams/PstreamImpl.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Initialize argList (requires Pstream and the I/O streams + +#include "global/argList/argList.C" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Read and set cell models -#include +#include "meshes/meshShapes/cellModeller/globalCellModeller.C" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Create the jobInfo file in the $FOAM_JOB_DIR/runningJobs directory -#include +#include "global/JobInfo/JobInfo.C" // ******************** vim: set ft=cpp sw=4 sts=4 et: ********************* // -- 2.11.4.GIT