diff options
author | Benoit Foucher <benoit@zeroc.com> | 2004-02-10 23:18:16 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2004-02-10 23:18:16 +0000 |
commit | 61e07f2c8b2110b405e47c8bdc94095e0d754042 (patch) | |
tree | 14a31ba3bfc89b806c81f92f388276f467b46e62 /cpp/src/Ice/FactoryTableDef.cpp | |
parent | Fixed Win32 build (_win9x -> win9x()) (diff) | |
download | ice-61e07f2c8b2110b405e47c8bdc94095e0d754042.tar.bz2 ice-61e07f2c8b2110b405e47c8bdc94095e0d754042.tar.xz ice-61e07f2c8b2110b405e47c8bdc94095e0d754042.zip |
MacOS X port.
Diffstat (limited to 'cpp/src/Ice/FactoryTableDef.cpp')
-rw-r--r-- | cpp/src/Ice/FactoryTableDef.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cpp/src/Ice/FactoryTableDef.cpp b/cpp/src/Ice/FactoryTableDef.cpp index c225ffc57c5..1b1db33163a 100644 --- a/cpp/src/Ice/FactoryTableDef.cpp +++ b/cpp/src/Ice/FactoryTableDef.cpp @@ -15,6 +15,10 @@ #include <Ice/FactoryTableDef.h> #include <Ice/UserExceptionFactory.h> +#ifdef __APPLE__ +# include <dlfcn.h> +#endif + namespace Ice { @@ -52,6 +56,28 @@ Ice::FactoryTableDef::getExceptionFactory(const std::string& t) const { IceUtil::Mutex::Lock lock(_m); EFTable::const_iterator i = _eft.find(t); +#ifdef __APPLE__ + if(i == _eft.end()) + { + lock.release(); + + // + // Try to find the symbol, if found this should trigger the + // object static constructors to be called. + // + std::string symbol = "__F"; + for(std::string::const_iterator p = t.begin(); p != t.end(); ++p) + { + symbol += ((*p) == ':') ? '_' : *p; + } + symbol += "__initializer"; + dlsym(RTLD_DEFAULT, symbol.c_str()); + + lock.acquire(); + + i = _eft.find(t); + } +#endif return i != _eft.end() ? i->second.first : IceInternal::UserExceptionFactoryPtr(); } @@ -101,6 +127,28 @@ Ice::FactoryTableDef::getObjectFactory(const std::string& t) const { IceUtil::Mutex::Lock lock(_m); OFTable::const_iterator i = _oft.find(t); +#ifdef __APPLE__ + if(i == _oft.end()) + { + lock.release(); + + // + // Try to find the symbol, if found this should trigger the + // object static constructors to be called. + // + std::string symbol = "__F"; + for(std::string::const_iterator p = t.begin(); p != t.end(); ++p) + { + symbol += ((*p) == ':') ? '_' : *p; + } + symbol += "__initializer"; + dlsym(RTLD_DEFAULT, symbol.c_str()); + + lock.acquire(); + + i = _oft.find(t); + } +#endif return i != _oft.end() ? i->second.first : ObjectFactoryPtr(); } |