More hacking on static linking (iOS) support
This commit is contained in:
@@ -1061,13 +1061,22 @@ inline void EnvironmentsData::getRegisteredEnvironments(
|
|||||||
static bool loadEnv(OUString const & cLibStem,
|
static bool loadEnv(OUString const & cLibStem,
|
||||||
uno_Environment * pEnv)
|
uno_Environment * pEnv)
|
||||||
{
|
{
|
||||||
#ifdef IOS
|
#ifdef DISABLE_DYNLOADING
|
||||||
oslModule hMod;
|
oslModule hMod;
|
||||||
uno_initEnvironmentFunc fpInit = NULL;
|
uno_initEnvironmentFunc fpInit = NULL;
|
||||||
|
|
||||||
if (cLibStem.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("gcc3_uno")) )
|
if (cLibStem.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME "_uno")) )
|
||||||
fpInit = gcc3_uno_initEnvironment;
|
fpInit = CPPU_ENV_uno_initEnvironment;
|
||||||
osl_getModuleHandle( NULL, &hMod );
|
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
|
#else
|
||||||
// late init with some code from matching uno language binding
|
// late init with some code from matching uno language binding
|
||||||
// will be unloaded by environment
|
// will be unloaded by environment
|
||||||
|
@@ -330,7 +330,29 @@ static inline void setNegativeBridge( const OUString & rBridgeName )
|
|||||||
MutexGuard aGuard( rData.aNegativeLibsMutex );
|
MutexGuard aGuard( rData.aNegativeLibsMutex );
|
||||||
rData.aNegativeLibs.insert( rBridgeName );
|
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 )
|
static inline oslModule loadModule( const OUString & rBridgeName )
|
||||||
SAL_THROW(())
|
SAL_THROW(())
|
||||||
{
|
{
|
||||||
@@ -353,6 +375,9 @@ static inline oslModule loadModule( const OUString & rBridgeName )
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
static Mapping loadExternalMapping(
|
static Mapping loadExternalMapping(
|
||||||
const Environment & rFrom, const Environment & rTo, const OUString & rAddPurpose )
|
const Environment & rFrom, const Environment & rTo, const OUString & rAddPurpose )
|
||||||
@@ -361,6 +386,43 @@ static Mapping loadExternalMapping(
|
|||||||
OSL_ASSERT( rFrom.is() && rTo.is() );
|
OSL_ASSERT( rFrom.is() && rTo.is() );
|
||||||
if (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
|
// find proper lib
|
||||||
oslModule hModule = 0;
|
oslModule hModule = 0;
|
||||||
OUString aName;
|
OUString aName;
|
||||||
@@ -393,6 +455,7 @@ static Mapping loadExternalMapping(
|
|||||||
::osl_unloadModule( hModule );
|
::osl_unloadModule( hModule );
|
||||||
setNegativeBridge( aName );
|
setNegativeBridge( aName );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return Mapping();
|
return Mapping();
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,8 @@ namespace
|
|||||||
class theAccessDPath : public rtl::Static<buildAccessDPath, theAccessDPath> {};
|
class theAccessDPath : public rtl::Static<buildAccessDPath, theAccessDPath> {};
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
#ifndef DISABLE_DYNLOADING
|
||||||
|
|
||||||
static const ::std::vector< OUString > * getAccessDPath() SAL_THROW(())
|
static const ::std::vector< OUString > * getAccessDPath() SAL_THROW(())
|
||||||
{
|
{
|
||||||
return theAccessDPath::get().getAccessDPath();
|
return theAccessDPath::get().getAccessDPath();
|
||||||
@@ -321,6 +322,8 @@ static void getLibEnv(oslModule lib,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" {static void s_getFactory(va_list * pParam)
|
extern "C" {static void s_getFactory(va_list * pParam)
|
||||||
{
|
{
|
||||||
component_getFactoryFunc pSym = va_arg(*pParam, component_getFactoryFunc);
|
component_getFactoryFunc pSym = va_arg(*pParam, component_getFactoryFunc);
|
||||||
@@ -361,7 +364,21 @@ Reference< XInterface > invokeComponentFactory(
|
|||||||
uno::Environment env;
|
uno::Environment env;
|
||||||
OUString aEnvTypeName;
|
OUString aEnvTypeName;
|
||||||
|
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) lib;
|
||||||
|
(void) rPrefix;
|
||||||
|
// It seems that the only UNO components that have
|
||||||
|
// component_getImplementationEnvironment functions are the JDBC
|
||||||
|
// and ADO (whatever that is) database connectivity thingies
|
||||||
|
// neither of which make sense on iOS (which is the only platform
|
||||||
|
// for which DISABLE_DYNLOADING is intended, really). So we can
|
||||||
|
// simoly bypass the getLibEnv() stuff and don't need to wonder
|
||||||
|
// how to find out what function to call at this point if
|
||||||
|
// statically linked.
|
||||||
|
aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
||||||
|
#else
|
||||||
getLibEnv(lib, &env, &aEnvTypeName, currentEnv, rImplName, rPrefix);
|
getLibEnv(lib, &env, &aEnvTypeName, currentEnv, rImplName, rPrefix);
|
||||||
|
#endif
|
||||||
|
|
||||||
OString aImplName(
|
OString aImplName(
|
||||||
OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
|
OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
|
||||||
@@ -439,7 +456,7 @@ Reference< XInterface > invokeComponentFactory(
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef DISABLE_DYNLOADING
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
// In stoc/source/bootstrap/services.cxx.
|
// In stoc/source/bootstrap/services.cxx.
|
||||||
@@ -461,7 +478,7 @@ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory(
|
|||||||
OUString const & rPrefix )
|
OUString const & rPrefix )
|
||||||
SAL_THROW( (loader::CannotActivateFactoryException) )
|
SAL_THROW( (loader::CannotActivateFactoryException) )
|
||||||
{
|
{
|
||||||
#ifndef IOS
|
#ifndef DISABLE_DYNLOADING
|
||||||
OUString sLibName(rLibName);
|
OUString sLibName(rLibName);
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
@@ -506,13 +523,20 @@ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory(
|
|||||||
|
|
||||||
oslGenericFunction pSym = NULL;
|
oslGenericFunction pSym = NULL;
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef DISABLE_DYNLOADING
|
||||||
if ( rLibName.equals( OUSTR("bootstrap.uno" SAL_DLLEXTENSION)) )
|
if ( rLibName.equals( OUSTR("bootstrap.uno" SAL_DLLEXTENSION)) )
|
||||||
pSym = (oslGenericFunction) bootstrap_component_getFactory;
|
pSym = (oslGenericFunction) bootstrap_component_getFactory;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if OSL_DEBUG_LEVEL > 1
|
||||||
|
OSL_TRACE( "%s: attempting to load unknown library %s", __PRETTY_FUNCTION__, OUStringToOString( rLibName, RTL_TEXTENCODING_ASCII_US ).getStr() );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
if ( pSym == NULL )
|
if ( pSym == NULL )
|
||||||
pSym = osl_getFunctionSymbol( lib, aGetFactoryName.pData );
|
pSym = osl_getFunctionSymbol( lib, aGetFactoryName.pData );
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pSym != 0)
|
if (pSym != 0)
|
||||||
{
|
{
|
||||||
@@ -573,6 +597,8 @@ Reference< XInterface > SAL_CALL invokeStaticComponentFactory(
|
|||||||
return xRet;
|
return xRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_DYNLOADING
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
extern "C" { static void s_writeInfo(va_list * pParam)
|
extern "C" { static void s_writeInfo(va_list * pParam)
|
||||||
{
|
{
|
||||||
@@ -697,6 +723,8 @@ void SAL_CALL writeSharedLibComponentInfo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DISABLE_DYNLOADING
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -46,7 +46,6 @@ $(eval $(call gb_Library_add_defs,sal,\
|
|||||||
-DFORCE_SYSALLOC \
|
-DFORCE_SYSALLOC \
|
||||||
) \
|
) \
|
||||||
$(if $(filter $(OS),IOS), \
|
$(if $(filter $(OS),IOS), \
|
||||||
-DNO_DL_FUNCTIONS \
|
|
||||||
-DNO_CHILD_PROCESSES \
|
-DNO_CHILD_PROCESSES \
|
||||||
) \
|
) \
|
||||||
$(LFS_CFLAGS) \
|
$(LFS_CFLAGS) \
|
||||||
|
@@ -128,7 +128,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool run() const
|
bool run() const
|
||||||
{
|
{
|
||||||
#ifdef IOS
|
#ifdef DISABLE_DYNLOADING
|
||||||
// For iOS cppunit plugins aren't really "plugins" (shared
|
// For iOS cppunit plugins aren't really "plugins" (shared
|
||||||
// libraries), but just static archives. In the real main
|
// libraries), but just static archives. In the real main
|
||||||
// program of a cppunit app, which calls the lo_main() that
|
// program of a cppunit app, which calls the lo_main() that
|
||||||
@@ -206,7 +206,7 @@ SAL_IMPLEMENT_MAIN() {
|
|||||||
if (rtl_getAppCommandArgCount() - index < 3) {
|
if (rtl_getAppCommandArgCount() - index < 3) {
|
||||||
usageFailure();
|
usageFailure();
|
||||||
}
|
}
|
||||||
#ifndef IOS
|
#ifndef DISABLE_DYNLOADING
|
||||||
rtl::OUString lib(getArgument(index + 1));
|
rtl::OUString lib(getArgument(index + 1));
|
||||||
rtl::OUString sym(getArgument(index + 2));
|
rtl::OUString sym(getArgument(index + 2));
|
||||||
modules.push_back(new osl::Module(lib, SAL_LOADMODULE_GLOBAL));
|
modules.push_back(new osl::Module(lib, SAL_LOADMODULE_GLOBAL));
|
||||||
|
@@ -50,7 +50,7 @@ namespace cppunittester
|
|||||||
extern "C" typedef LibreOfficeProtector * SAL_CALL ProtectorFactory();
|
extern "C" typedef LibreOfficeProtector * SAL_CALL ProtectorFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef DISABLE_DYNLOADING
|
||||||
extern "C" CppUnit::Protector *unoexceptionprotector();
|
extern "C" CppUnit::Protector *unoexceptionprotector();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -50,8 +50,8 @@ extern "C" int UnicodeToText(char *, size_t, const sal_Unicode *, sal_Int32);
|
|||||||
|
|
||||||
static sal_Bool getModulePathFromAddress(void * address, rtl_String ** path) {
|
static sal_Bool getModulePathFromAddress(void * address, rtl_String ** path) {
|
||||||
sal_Bool result = sal_False;
|
sal_Bool result = sal_False;
|
||||||
/* Bah, we do want to use dladdr here also on iOS, I think? */
|
// We do want to have this functionality also in the
|
||||||
#if !defined(NO_DL_FUNCTIONS) || defined(IOS)
|
// DISABLE_DYNLOADING case, I think?
|
||||||
#if defined(AIX)
|
#if defined(AIX)
|
||||||
int size = 4 * 1024;
|
int size = 4 * 1024;
|
||||||
char *buf, *filename=NULL;
|
char *buf, *filename=NULL;
|
||||||
@@ -114,7 +114,6 @@ static sal_Bool getModulePathFromAddress(void * address, rtl_String ** path) {
|
|||||||
{
|
{
|
||||||
result = sal_False;
|
result = sal_False;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -158,7 +157,7 @@ oslModule SAL_CALL osl_loadModuleAscii(const sal_Char *pModuleName, sal_Int32 nR
|
|||||||
"sal.osl", "only either LAZY or NOW");
|
"sal.osl", "only either LAZY or NOW");
|
||||||
if (pModuleName)
|
if (pModuleName)
|
||||||
{
|
{
|
||||||
#ifndef NO_DL_FUNCTIONS
|
#ifndef DISABLE_DYNLOADING
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
(void) nRtldMode;
|
(void) nRtldMode;
|
||||||
void *pLib = lo_dlopen(pModuleName);
|
void *pLib = lo_dlopen(pModuleName);
|
||||||
@@ -175,10 +174,10 @@ oslModule SAL_CALL osl_loadModuleAscii(const sal_Char *pModuleName, sal_Int32 nR
|
|||||||
#endif
|
#endif
|
||||||
return ((oslModule)(pLib));
|
return ((oslModule)(pLib));
|
||||||
|
|
||||||
#else /* NO_DL_FUNCTIONS */
|
#else /* DISABLE_DYNLOADING */
|
||||||
(void) nRtldMode;
|
(void) nRtldMode;
|
||||||
printf("No DL Functions\n");
|
printf("No DL Functions\n");
|
||||||
#endif /* NO_DL_FUNCTIONS */
|
#endif /* DISABLE_DYNLOADING */
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -220,7 +219,7 @@ oslModule osl_loadModuleRelativeAscii(
|
|||||||
sal_Bool SAL_CALL
|
sal_Bool SAL_CALL
|
||||||
osl_getModuleHandle(rtl_uString *, oslModule *pResult)
|
osl_getModuleHandle(rtl_uString *, oslModule *pResult)
|
||||||
{
|
{
|
||||||
#if !defined(NO_DL_FUNCTIONS) || defined(IOS)
|
#if !defined(DISABLE_DYNLOADING) || defined(IOS)
|
||||||
*pResult = (oslModule) RTLD_DEFAULT;
|
*pResult = (oslModule) RTLD_DEFAULT;
|
||||||
#else
|
#else
|
||||||
*pResult = NULL;
|
*pResult = NULL;
|
||||||
@@ -235,7 +234,7 @@ void SAL_CALL osl_unloadModule(oslModule hModule)
|
|||||||
{
|
{
|
||||||
if (hModule)
|
if (hModule)
|
||||||
{
|
{
|
||||||
#ifndef NO_DL_FUNCTIONS
|
#ifndef DISABLE_DYNLOADING
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
int nRet = lo_dlclose(hModule);
|
int nRet = lo_dlclose(hModule);
|
||||||
#else
|
#else
|
||||||
@@ -243,7 +242,7 @@ void SAL_CALL osl_unloadModule(oslModule hModule)
|
|||||||
#endif
|
#endif
|
||||||
SAL_INFO_IF(
|
SAL_INFO_IF(
|
||||||
nRet != 0, "sal.osl", "dlclose(" << hModule << "): " << dlerror());
|
nRet != 0, "sal.osl", "dlclose(" << hModule << "): " << dlerror());
|
||||||
#endif /* ifndef NO_DL_FUNCTIONS */
|
#endif /* ifndef DISABLE_DYNLOADING */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,8 +264,8 @@ osl_getAsciiFunctionSymbol(oslModule Module, const sal_Char *pSymbol)
|
|||||||
{
|
{
|
||||||
void *fcnAddr = NULL;
|
void *fcnAddr = NULL;
|
||||||
|
|
||||||
/* We do want to use dlsym on iOS */
|
// We do want to use dlsym() also in the DISABLE_DYNLOADING case
|
||||||
#if !defined(NO_DL_FUNCTIONS) || defined(IOS)
|
// just to look up symbols in the static executable, I think.
|
||||||
if (pSymbol)
|
if (pSymbol)
|
||||||
{
|
{
|
||||||
fcnAddr = dlsym(Module, pSymbol);
|
fcnAddr = dlsym(Module, pSymbol);
|
||||||
@@ -274,7 +273,6 @@ osl_getAsciiFunctionSymbol(oslModule Module, const sal_Char *pSymbol)
|
|||||||
fcnAddr == 0, "sal.osl",
|
fcnAddr == 0, "sal.osl",
|
||||||
"dlsym(" << Module << ", " << pSymbol << "): " << dlerror());
|
"dlsym(" << Module << ", " << pSymbol << "): " << dlerror());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return (oslGenericFunction) fcnAddr;
|
return (oslGenericFunction) fcnAddr;
|
||||||
}
|
}
|
||||||
|
@@ -119,7 +119,7 @@ oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif !defined(NO_DL_FUNCTIONS)
|
#else
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
|
oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
|
||||||
@@ -169,17 +169,7 @@ oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* NO_DL_FUNCTIONS */
|
#endif
|
||||||
|
|
||||||
oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
|
|
||||||
rtl_uString ** ppFileURL
|
|
||||||
) SAL_THROW_EXTERN_C()
|
|
||||||
{
|
|
||||||
/* Fallback to ordinary osl_getExecutableFile(). */
|
|
||||||
return osl_getExecutableFile (ppFileURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* NO_DL_FUNCTIONS */
|
|
||||||
|
|
||||||
/***************************************
|
/***************************************
|
||||||
CommandArgs_Impl.
|
CommandArgs_Impl.
|
||||||
|
@@ -42,6 +42,8 @@ using osl::MutexGuard;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef DISABLE_DYNLOADING
|
||||||
|
|
||||||
static void rtl_notifyUnloadingListeners();
|
static void rtl_notifyUnloadingListeners();
|
||||||
|
|
||||||
static sal_Bool isEqualTimeValue ( const TimeValue* time1, const TimeValue* time2)
|
static sal_Bool isEqualTimeValue ( const TimeValue* time1, const TimeValue* time2)
|
||||||
@@ -118,14 +120,23 @@ static osl::Mutex& getUnloadingMutex()
|
|||||||
return theUnloadingMutex::get();
|
return theUnloadingMutex::get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" void rtl_moduleCount_acquire(rtl_ModuleCount * that )
|
extern "C" void rtl_moduleCount_acquire(rtl_ModuleCount * that )
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) that;
|
||||||
|
#else
|
||||||
rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that;
|
rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that;
|
||||||
osl_incrementInterlockedCount( &pMod->counter);
|
osl_incrementInterlockedCount( &pMod->counter);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void rtl_moduleCount_release( rtl_ModuleCount * that )
|
extern "C" void rtl_moduleCount_release( rtl_ModuleCount * that )
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) that;
|
||||||
|
#else
|
||||||
rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that;
|
rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that;
|
||||||
OSL_ENSURE( pMod->counter >0 , "library counter incorrect" );
|
OSL_ENSURE( pMod->counter >0 , "library counter incorrect" );
|
||||||
osl_decrementInterlockedCount( &pMod->counter);
|
osl_decrementInterlockedCount( &pMod->counter);
|
||||||
@@ -140,8 +151,10 @@ extern "C" void rtl_moduleCount_release( rtl_ModuleCount * that )
|
|||||||
pMod->unusedSince.Nanosec= 0;
|
pMod->unusedSince.Nanosec= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_DYNLOADING
|
||||||
|
|
||||||
struct hashModule
|
struct hashModule
|
||||||
{
|
{
|
||||||
@@ -176,8 +189,15 @@ static ModuleMap& getModuleMap()
|
|||||||
return *g_pMap;
|
return *g_pMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, TimeValue * libUnused)
|
extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, TimeValue * libUnused)
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) that;
|
||||||
|
(void) libUnused;
|
||||||
|
return sal_False;
|
||||||
|
#else
|
||||||
if (that->counter == 0)
|
if (that->counter == 0)
|
||||||
{
|
{
|
||||||
MutexGuard guard( getUnloadingMutex());
|
MutexGuard guard( getUnloadingMutex());
|
||||||
@@ -187,11 +207,16 @@ extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (that->counter == 0);
|
return (that->counter == 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" sal_Bool SAL_CALL rtl_registerModuleForUnloading( oslModule module)
|
extern "C" sal_Bool SAL_CALL rtl_registerModuleForUnloading( oslModule module)
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) module;
|
||||||
|
return sal_False;
|
||||||
|
#else
|
||||||
MutexGuard guard( getUnloadingMutex());
|
MutexGuard guard( getUnloadingMutex());
|
||||||
ModuleMap& moduleMap= getModuleMap();
|
ModuleMap& moduleMap= getModuleMap();
|
||||||
sal_Bool ret= sal_True;
|
sal_Bool ret= sal_True;
|
||||||
@@ -219,10 +244,14 @@ extern "C" sal_Bool SAL_CALL rtl_registerModuleForUnloading( oslModule module)
|
|||||||
ret= sal_False;
|
ret= sal_False;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void SAL_CALL rtl_unregisterModuleForUnloading( oslModule module)
|
extern "C" void SAL_CALL rtl_unregisterModuleForUnloading( oslModule module)
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) module;
|
||||||
|
#else
|
||||||
MutexGuard guard( getUnloadingMutex());
|
MutexGuard guard( getUnloadingMutex());
|
||||||
|
|
||||||
ModuleMap& moduleMap= getModuleMap();
|
ModuleMap& moduleMap= getModuleMap();
|
||||||
@@ -236,10 +265,14 @@ extern "C" void SAL_CALL rtl_unregisterModuleForUnloading( oslModule module)
|
|||||||
if( it->second.first == 0)
|
if( it->second.first == 0)
|
||||||
moduleMap.erase( it);
|
moduleMap.erase( it);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void SAL_CALL rtl_unloadUnusedModules( TimeValue* libUnused)
|
extern "C" void SAL_CALL rtl_unloadUnusedModules( TimeValue* libUnused)
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) libUnused;
|
||||||
|
#else
|
||||||
MutexGuard guard( getUnloadingMutex());
|
MutexGuard guard( getUnloadingMutex());
|
||||||
|
|
||||||
typedef std::list< oslModule, rtl::Allocator<oslModule> > list_type;
|
typedef std::list< oslModule, rtl::Allocator<oslModule> > list_type;
|
||||||
@@ -286,8 +319,10 @@ extern "C" void SAL_CALL rtl_unloadUnusedModules( TimeValue* libUnused)
|
|||||||
{
|
{
|
||||||
moduleMap.erase( *un_it);
|
moduleMap.erase( *un_it);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_DYNLOADING
|
||||||
|
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
// Unloading Listener Administration
|
// Unloading Listener Administration
|
||||||
@@ -374,32 +409,45 @@ static inline void recycleCookie( sal_Int32 i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// calling the function twice with the same arguments will return tow different cookies.
|
// calling the function twice with the same arguments will return tow different cookies.
|
||||||
// The listener will then notified twice.
|
// The listener will then notified twice.
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
sal_Int32 SAL_CALL rtl_addUnloadingListener( rtl_unloadingListenerFunc callback, void* _this)
|
sal_Int32 SAL_CALL rtl_addUnloadingListener( rtl_unloadingListenerFunc callback, void* _this)
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) callback;
|
||||||
|
(void) _this;
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
MutexGuard guard( getUnloadingMutex());
|
MutexGuard guard( getUnloadingMutex());
|
||||||
|
|
||||||
sal_Int32 cookie= getCookie();
|
sal_Int32 cookie= getCookie();
|
||||||
ListenerMap& listenerMap= getListenerMap();
|
ListenerMap& listenerMap= getListenerMap();
|
||||||
listenerMap[ cookie]= std::make_pair( callback, _this);
|
listenerMap[ cookie]= std::make_pair( callback, _this);
|
||||||
return cookie;
|
return cookie;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
void SAL_CALL rtl_removeUnloadingListener( sal_Int32 cookie )
|
void SAL_CALL rtl_removeUnloadingListener( sal_Int32 cookie )
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) cookie;
|
||||||
|
#else
|
||||||
MutexGuard guard( getUnloadingMutex());
|
MutexGuard guard( getUnloadingMutex());
|
||||||
|
|
||||||
ListenerMap& listenerMap= getListenerMap();
|
ListenerMap& listenerMap= getListenerMap();
|
||||||
size_t removedElements= listenerMap.erase( cookie);
|
size_t removedElements= listenerMap.erase( cookie);
|
||||||
if( removedElements )
|
if( removedElements )
|
||||||
recycleCookie( cookie);
|
recycleCookie( cookie);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_DYNLOADING
|
||||||
|
|
||||||
static void rtl_notifyUnloadingListeners()
|
static void rtl_notifyUnloadingListeners()
|
||||||
{
|
{
|
||||||
@@ -411,4 +459,6 @@ static void rtl_notifyUnloadingListeners()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -364,7 +364,7 @@ static ImplTextEncodingData const aImplJavaUtf8TextEncodingData
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if defined IOS || defined ANDROID
|
#if defined DISABLE_DYNLOADING || defined ANDROID
|
||||||
|
|
||||||
extern "C" ImplTextEncodingData const * sal_getFullTextEncodingData(
|
extern "C" ImplTextEncodingData const * sal_getFullTextEncodingData(
|
||||||
rtl_TextEncoding); // from tables.cxx in sal_textenc library
|
rtl_TextEncoding); // from tables.cxx in sal_textenc library
|
||||||
|
@@ -118,14 +118,14 @@ static struct ImplementationEntry g_entries[] =
|
|||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef IOS
|
#ifndef DISABLE_DYNLOADING
|
||||||
SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_canUnload( TimeValue *pTime )
|
SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_canUnload( TimeValue *pTime )
|
||||||
{
|
{
|
||||||
return g_moduleCount.canUnload( &g_moduleCount , pTime );
|
return g_moduleCount.canUnload( &g_moduleCount , pTime );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef DISABLE_DYNLOADING
|
||||||
#define component_getFactory bootstrap_component_getFactory
|
#define component_getFactory bootstrap_component_getFactory
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -229,9 +229,16 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo(
|
|||||||
|
|
||||||
throw(CannotRegisterImplementationException, RuntimeException)
|
throw(CannotRegisterImplementationException, RuntimeException)
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
(void) xKey;
|
||||||
|
(void) rLibName;
|
||||||
|
OSL_FAIL( "DllComponentLoader::writeRegistryInfo() should not be called I think?" );
|
||||||
|
return sal_False;
|
||||||
|
#else
|
||||||
writeSharedLibComponentInfo(
|
writeSharedLibComponentInfo(
|
||||||
expand_url( rLibName ), OUString(), m_xSMgr, xKey );
|
expand_url( rLibName ), OUString(), m_xSMgr, xKey );
|
||||||
return sal_True;
|
return sal_True;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user