diff --git a/SConstruct b/SConstruct index 86b6d3260a4..a2e5490ab36 100644 --- a/SConstruct +++ b/SConstruct @@ -1818,7 +1818,6 @@ configh['SOLARIS'] = 1 if env['OS'] == 'Solaris' else None configh['DARWIN'] = 1 if env['OS'] == 'Darwin' else None if env['OS'] == 'Solaris' or env['HAS_CLANG']: - configh['NEEDS_GENERIC_TEMPL_STATIC_DECL'] = 1 env["RPATHPREFIX"] = "-Wl,-rpath," if env["OS"] == "Darwin" and env["use_rpath_linkage"] and not env.subst("$__RPATH"): diff --git a/include/cantera/base/config.h.in b/include/cantera/base/config.h.in index 85a4cf8c30a..4c5969fe2e9 100644 --- a/include/cantera/base/config.h.in +++ b/include/cantera/base/config.h.in @@ -59,20 +59,6 @@ typedef int ftnlen; // Fortran hidden string length type // with a native compiler {SOLARIS!s} -//---------- C++ Compiler Variations ------------------------------ - -// This define is needed to account for the variability for how -// static variables in templated classes are defined. Right now -// this is only turned on for the SunPro compiler on Solaris. -// in that system , you need to declare the static storage variable. -// with the following line in the include file -// -// template Cabinet* Cabinet::s_storage; -// -// Note, on other systems that declaration is treated as a definition -// and this leads to multiple defines at link time -{NEEDS_GENERIC_TEMPL_STATIC_DECL!s} - //-------------- Optional Cantera Capabilities ---------------------- // Enable Sundials to use an external BLAS/LAPACK library if it was diff --git a/src/clib/Cabinet.h b/src/clib/Cabinet.h index 77a6eebf539..c8c1c435ba4 100644 --- a/src/clib/Cabinet.h +++ b/src/clib/Cabinet.h @@ -205,13 +205,4 @@ class Cabinet std::vector m_table; }; -//! Declaration stating that the storage for the static member -//! of each instantiated template will exist -/*! - * The actual storage will be allocated in .cpp files - */ -#ifdef NEEDS_GENERIC_TEMPL_STATIC_DECL -template Cabinet* Cabinet::s_storage; -#endif - #endif diff --git a/src/clib/ct.cpp b/src/clib/ct.cpp index d57518d6010..0045393fa91 100644 --- a/src/clib/ct.cpp +++ b/src/clib/ct.cpp @@ -36,6 +36,7 @@ typedef Cabinet XmlCabinet; template<> ThermoCabinet* ThermoCabinet::s_storage = 0; template<> KineticsCabinet* KineticsCabinet::s_storage = 0; template<> TransportCabinet* TransportCabinet::s_storage = 0; +template<> XmlCabinet* XmlCabinet::s_storage; // defined in ctxml.cpp /** * Exported functions. diff --git a/src/clib/ctmultiphase.cpp b/src/clib/ctmultiphase.cpp index 293591dd941..c57fc663b57 100644 --- a/src/clib/ctmultiphase.cpp +++ b/src/clib/ctmultiphase.cpp @@ -17,7 +17,10 @@ using namespace std; using namespace Cantera; typedef Cabinet mixCabinet; +typedef Cabinet ThermoCabinet; + template<> mixCabinet* mixCabinet::s_storage = 0; +template<> ThermoCabinet* ThermoCabinet::s_storage; // defined in ct.cpp extern "C" { @@ -54,7 +57,7 @@ extern "C" { int mix_addPhase(int i, int j, double moles) { try { - mixCabinet::item(i).addPhase(&Cabinet::item(j), moles); + mixCabinet::item(i).addPhase(&ThermoCabinet::item(j), moles); return 0; } catch (...) { return handleAllExceptions(-1, ERR); diff --git a/src/clib/ctonedim.cpp b/src/clib/ctonedim.cpp index f0644ca689d..766a3b59ea9 100644 --- a/src/clib/ctonedim.cpp +++ b/src/clib/ctonedim.cpp @@ -29,6 +29,9 @@ template<> DomainCabinet* DomainCabinet::s_storage = 0; typedef Cabinet ThermoCabinet; typedef Cabinet KineticsCabinet; typedef Cabinet TransportCabinet; +template<> ThermoCabinet* ThermoCabinet::s_storage; // defined in ct.cpp +template<> KineticsCabinet* KineticsCabinet::s_storage; // defined in ct.cpp +template<> TransportCabinet* TransportCabinet::s_storage; // defined in ct.cpp extern "C" { diff --git a/src/clib/ctreactor.cpp b/src/clib/ctreactor.cpp index 3bc9d47d6b4..afd7f130d69 100644 --- a/src/clib/ctreactor.cpp +++ b/src/clib/ctreactor.cpp @@ -32,6 +32,9 @@ template<> NetworkCabinet* NetworkCabinet::s_storage = 0; template<> FlowDeviceCabinet* FlowDeviceCabinet::s_storage = 0; template<> WallCabinet* WallCabinet::s_storage = 0; template<> ReactorSurfaceCabinet* ReactorSurfaceCabinet::s_storage = 0; +template<> FuncCabinet* FuncCabinet::s_storage; // defined in ctfunc.cpp +template<> ThermoCabinet* ThermoCabinet::s_storage; // defined in ct.cpp +template<> KineticsCabinet* KineticsCabinet::s_storage; // defined in ct.cpp extern "C" { diff --git a/src/clib/ctrpath.cpp b/src/clib/ctrpath.cpp index b645d26599b..1ee6724fc5c 100644 --- a/src/clib/ctrpath.cpp +++ b/src/clib/ctrpath.cpp @@ -23,6 +23,7 @@ template<> DiagramCabinet* DiagramCabinet::s_storage = 0; template<> BuilderCabinet* BuilderCabinet::s_storage = 0; typedef Cabinet KineticsCabinet; +template<> KineticsCabinet* KineticsCabinet::s_storage; // defined in ct.cpp extern "C" { diff --git a/src/clib/ctsurf.cpp b/src/clib/ctsurf.cpp index b65dcece19b..65c4eb21c60 100644 --- a/src/clib/ctsurf.cpp +++ b/src/clib/ctsurf.cpp @@ -17,6 +17,8 @@ using namespace std; using namespace Cantera; typedef Cabinet ThermoCabinet; +template<> ThermoCabinet* ThermoCabinet::s_storage; // defined in ct.cpp + extern "C" {