summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cppe/Gen.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2005-07-20 00:59:46 +0000
committerMichi Henning <michi@zeroc.com>2005-07-20 00:59:46 +0000
commit154d294f53e38f1efc716f579b05ace811b6fe3a (patch)
treed9f95db34692238b9e760cf1038f6d6d69e2bc6a /cpp/src/slice2cppe/Gen.cpp
parentfix for signed -> unsigned conversion (diff)
downloadice-154d294f53e38f1efc716f579b05ace811b6fe3a.tar.bz2
ice-154d294f53e38f1efc716f579b05ace811b6fe3a.tar.xz
ice-154d294f53e38f1efc716f579b05ace811b6fe3a.zip
Fixed bug 369.
Diffstat (limited to 'cpp/src/slice2cppe/Gen.cpp')
-rw-r--r--cpp/src/slice2cppe/Gen.cpp13
1 files changed, 11 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;";
+ }
}
}