Handle lack of module loading/unloading API when DISABLE_DYNLOADING

There are basicically two classes of cases:

1) Where the code is for obscure historical reasons or what I see as
misguided "optimization" split into a more libraries than necessary,
and these then are loaded at run-time. Instead, just use direct
linking.

2) Where dynamic loading is part of the functionality offered to some
upper (scripting etc) layer, or where some system-specific non-LO
library is loaded dynamically, as it is not necessarily present on
end-user machines. Can't have such in the DISABLE_DYNLOADING case.

Change-Id: I9eceac5fb635245def2f4f3320821447bb7cd8c0
This commit is contained in:
Tor Lillqvist
2012-10-07 07:52:26 +03:00
parent 1691752dd2
commit 97593ae24a
51 changed files with 595 additions and 40 deletions

View File

@@ -1054,7 +1054,7 @@ static bool loadEnv(OUString const & cLibStem,
{
#ifdef DISABLE_DYNLOADING
oslModule hMod;
uno_initEnvironmentFunc fpInit = NULL;
uno_initEnvironmentFunc fpInit;
if ( cLibStem == CPPU_CURRENT_LANGUAGE_BINDING_NAME "_uno" )
fpInit = CPPU_ENV_uno_initEnvironment;
@@ -1083,13 +1083,13 @@ static bool loadEnv(OUString const & cLibStem,
OUString aSymbolName(RTL_CONSTASCII_USTRINGPARAM(UNO_INIT_ENVIRONMENT));
uno_initEnvironmentFunc fpInit = (uno_initEnvironmentFunc)
::osl_getFunctionSymbol( hMod, aSymbolName.pData );
#endif
if (!fpInit)
{
::osl_unloadModule( hMod );
return false;
}
#endif
(*fpInit)( pEnv ); // init of environment
::rtl_registerModuleForUnloading( hMod );

View File

@@ -29,6 +29,8 @@
namespace cppu { namespace detail {
#ifndef DISABLE_DYNLOADING
::oslModule loadModule(rtl::OUString const & name) {
rtl::OUStringBuffer b;
#if defined SAL_DLLPREFIX
@@ -42,6 +44,8 @@ namespace cppu { namespace detail {
SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY);
}
#endif
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -27,6 +27,8 @@ namespace rtl { class OUString; }
namespace cppu { namespace detail {
#ifndef DISABLE_DYNLOADING
/** Load a module.
@param name
@@ -38,6 +40,8 @@ namespace cppu { namespace detail {
*/
::oslModule loadModule(::rtl::OUString const & name);
#endif
} }
#endif