diff options
author | Michi Henning <michi@zeroc.com> | 2005-07-20 00:59:46 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-07-20 00:59:46 +0000 |
commit | 154d294f53e38f1efc716f579b05ace811b6fe3a (patch) | |
tree | d9f95db34692238b9e760cf1038f6d6d69e2bc6a /cpp/src/slice2cppe | |
parent | fix for signed -> unsigned conversion (diff) | |
download | ice-154d294f53e38f1efc716f579b05ace811b6fe3a.tar.bz2 ice-154d294f53e38f1efc716f579b05ace811b6fe3a.tar.xz ice-154d294f53e38f1efc716f579b05ace811b6fe3a.zip |
Fixed bug 369.
Diffstat (limited to 'cpp/src/slice2cppe')
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 13 | ||||
-rw-r--r-- | cpp/src/slice2cppe/Gen.h | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 02323403aba..a68f7e16936 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -303,7 +303,7 @@ Slice::Gen::generate(const UnitPtr& p) } Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllExport) : - H(h), C(c), _dllExport(dllExport) + H(h), C(c), _dllExport(dllExport), _doneStaticSymbol(false) { } @@ -611,7 +611,16 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) if(!p->isLocal()) { - H << sp << nl << "static " << name << " __" << p->name() << "_init;"; + // + // We need an instance here to trigger initialization if the implementation is in a shared libarry. + // But we do this only once per source file, because a single instance is sufficient to initialize + // all of the globals in a shared library. + // + if(!_doneStaticSymbol) + { + _doneStaticSymbol = true; + H << sp << nl << "static " << name << " __" << p->name() << "_init;"; + } } } diff --git a/cpp/src/slice2cppe/Gen.h b/cpp/src/slice2cppe/Gen.h index d8b6ab74aab..3d97d7c572d 100644 --- a/cpp/src/slice2cppe/Gen.h +++ b/cpp/src/slice2cppe/Gen.h @@ -84,6 +84,7 @@ private: ::IceUtil::Output& C; std::string _dllExport; + bool _doneStaticSymbol; }; class ProxyDeclVisitor : private ::IceUtil::noncopyable, public ParserVisitor |