summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-03-19 18:43:59 +0200
committerTor Lillqvist <tml@iki.fi>2012-03-21 00:00:05 +0200
commit128749140ffc6165f0bbbf34da3b5461c541b32f (patch)
tree844617bcaf03e4fa27e18217490739a890354792 /cppu
parentc0ab229dc74e116760866f27b5df12e76430aef5 (diff)
More hacking on static linking (iOS) support
Diffstat (limited to 'cppu')
-rw-r--r--cppu/source/uno/lbenv.cxx17
-rw-r--r--cppu/source/uno/lbmap.cxx65
2 files changed, 77 insertions, 5 deletions
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index baced8b1d3dd..0fc5239fddb9 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1061,13 +1061,22 @@ inline void EnvironmentsData::getRegisteredEnvironments(
static bool loadEnv(OUString const & cLibStem,
uno_Environment * pEnv)
{
-#ifdef IOS
+#ifdef DISABLE_DYNLOADING
oslModule hMod;
uno_initEnvironmentFunc fpInit = NULL;
- if (cLibStem.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("gcc3_uno")) )
- fpInit = gcc3_uno_initEnvironment;
- osl_getModuleHandle( NULL, &hMod );
+ if (cLibStem.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME "_uno")) )
+ fpInit = CPPU_ENV_uno_initEnvironment;
+ else
+ {
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE( "%s: Unhandled env: %s", __PRETTY_FUNCTION__, OUStringToOString( cLibStem, RTL_TEXTENCODING_ASCII_US).getStr() );
+#endif
+ return false;
+ }
+ // In the DISABLE_DYNLOADING case the functions that hMod is
+ // passed to below don't do anything with it anyway.
+ hMod = 0;
#else
// late init with some code from matching uno language binding
// will be unloaded by environment
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 070e2dde8367..219a4bfb358b 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -330,7 +330,29 @@ static inline void setNegativeBridge( const OUString & rBridgeName )
MutexGuard aGuard( rData.aNegativeLibsMutex );
rData.aNegativeLibs.insert( rBridgeName );
}
-//==================================================================================================
+
+#ifdef DISABLE_DYNLOADING
+
+static uno_ext_getMappingFunc selectMapFunc( const OUString & rBridgeName )
+ SAL_THROW(())
+{
+ if (rBridgeName.equalsAscii( CPPU_CURRENT_LANGUAGE_BINDING_NAME "_uno" ))
+ return CPPU_ENV_uno_ext_getMapping;
+#ifndef IOS
+ // I don't think the affine or log bridges will be needed on iOS,
+ // and DISABLE_DYNLOADING will hardly be used elsewhere, but if
+ // somebody wants to experiment, need to find out then whether
+ // these are needed.
+ if (rBridgeName.equalsAscii( "affine_uno_uno" ))
+ return affine_uno_uno_ext_getMapping;
+ if (rBridgeName.equalsAscii( "log_uno_uno" ))
+ return log_uno_uno_ext_getMapping;
+#endif
+ return 0;
+}
+
+#else
+
static inline oslModule loadModule( const OUString & rBridgeName )
SAL_THROW(())
{
@@ -353,6 +375,9 @@ static inline oslModule loadModule( const OUString & rBridgeName )
}
return 0;
}
+
+#endif
+
//==================================================================================================
static Mapping loadExternalMapping(
const Environment & rFrom, const Environment & rTo, const OUString & rAddPurpose )
@@ -361,6 +386,43 @@ static Mapping loadExternalMapping(
OSL_ASSERT( rFrom.is() && rTo.is() );
if (rFrom.is() && rTo.is())
{
+#ifdef DISABLE_DYNLOADING
+ OUString aName;
+ uno_ext_getMappingFunc fpGetMapFunc = 0;
+
+ if (EnvDcp::getTypeName(rFrom.getTypeName()).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_LB_UNO) ))
+ {
+ aName = getBridgeName( rTo, rFrom, rAddPurpose );
+ fpGetMapFunc = selectMapFunc( aName );
+ }
+ if (! fpGetMapFunc)
+ {
+ aName = getBridgeName( rFrom, rTo, rAddPurpose );
+ fpGetMapFunc = selectMapFunc( aName );
+ }
+ if (! fpGetMapFunc)
+ {
+ aName = getBridgeName( rTo, rFrom, rAddPurpose );
+ fpGetMapFunc = selectMapFunc( aName );
+ }
+
+ if (! fpGetMapFunc)
+ {
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE( "Could not find mapfunc for %s", OUStringToOString( aName, RTL_TEXTENCODING_ASCII_US ).getStr());
+#endif
+ return Mapping();
+ }
+
+ if (fpGetMapFunc)
+ {
+ Mapping aExt;
+ (*fpGetMapFunc)( (uno_Mapping **)&aExt, rFrom.get(), rTo.get() );
+ OSL_ASSERT( aExt.is() );
+ if (aExt.is())
+ return aExt;
+ }
+#else
// find proper lib
oslModule hModule = 0;
OUString aName;
@@ -393,6 +455,7 @@ static Mapping loadExternalMapping(
::osl_unloadModule( hModule );
setNegativeBridge( aName );
}
+#endif
}
return Mapping();
}