Kaydet (Commit) 1691752d authored tarafından Tor Lillqvist's avatar Tor Lillqvist

When DISABLE_DYNLOADING don't even provide any module loading/unloading API

Will then cause compilation errors where they are used, which will be
noticed and taken care of.  (The code chanaged to either use direct
linking instead, when it makes sense, or to just bypass the
functionality that requires dynamic loading.)

Much better than waiting until run-time to notice where dynamic
loading is attempted.

Change-Id: Ib0cb5a2524b5c63f8e27670e7d72e37ce2a8e6e9
üst 68669491
......@@ -52,13 +52,13 @@ $(eval $(call gb_Module_add_targets,sal,\
endif
$(eval $(call gb_Module_add_check_targets,sal,\
CppunitTest_Module_DLL \
$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,CppunitTest_Module_DLL) \
CppunitTest_sal_bytesequence \
CppunitTest_sal_checkapi \
CppunitTest_sal_osl_condition \
$(if $(filter $(OS),WNT),, \
CppunitTest_sal_osl_file) \
CppunitTest_sal_osl_module \
$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,CppunitTest_sal_osl_module) \
CppunitTest_sal_osl_old_test_file \
CppunitTest_sal_osl_security \
CppunitTest_sal_osl_thread \
......
......@@ -70,6 +70,8 @@ typedef void* oslModule;
*/
typedef void ( SAL_CALL *oslGenericFunction )( void );
#ifndef DISABLE_DYNLOADING
/** Load a shared library or module.
@param strModuleName denotes the name of the module to be loaded.
@param nRtldMode denotes the mode.
......@@ -129,6 +131,8 @@ SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModuleRelativeAscii(
FullTextEncodingDataSingleton in sal/textenc/textenc.cxx, so can be used
in its implementation without running into circles. */
#endif
/** Retrieve the handle of an already loaded module.
This function can be used to search for a function symbol in the process address space.
......@@ -151,10 +155,14 @@ SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModuleRelativeAscii(
*/
SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult);
#ifndef DISABLE_DYNLOADING
/** Release the module
*/
SAL_DLLPUBLIC void SAL_CALL osl_unloadModule(oslModule Module);
#endif
/** lookup the specified symbol name.
@return address of the symbol or NULL if lookup failed.
*/
......
......@@ -72,16 +72,24 @@ public:
Module(): m_Module(0){}
#ifndef DISABLE_DYNLOADING
Module( const ::rtl::OUString& strModuleName, sal_Int32 nRtldMode = SAL_LOADMODULE_DEFAULT) : m_Module(0)
{
load( strModuleName, nRtldMode);
}
#endif
~Module()
{
#ifndef DISABLE_DYNLOADING
osl_unloadModule(m_Module);
#endif
}
#ifndef DISABLE_DYNLOADING
sal_Bool SAL_CALL load( const ::rtl::OUString& strModuleName,
sal_Int32 nRtldMode = SAL_LOADMODULE_DEFAULT)
{
......@@ -119,6 +127,8 @@ public:
}
}
#endif
sal_Bool SAL_CALL is() const
{
return m_Module != NULL;
......
......@@ -43,6 +43,8 @@
extern "C" {
#ifndef DISABLE_DYNLOADING
oslModule SAL_CALL osl_loadModuleRelative(
oslGenericFunction const baseModule, rtl_uString * const relativePath,
sal_Int32 const mode)
......@@ -67,6 +69,8 @@ oslModule SAL_CALL osl_loadModuleRelative(
return ::osl_loadModule(abs.pData, mode);
}
#endif // !DISABLE_DYNLOADING
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -118,6 +118,9 @@ static sal_Bool getModulePathFromAddress(void * address, rtl_String ** path) {
return result;
}
#ifndef DISABLE_DYNLOADING
/*****************************************************************************/
/* osl_loadModule */
/*****************************************************************************/
......@@ -157,7 +160,6 @@ oslModule SAL_CALL osl_loadModuleAscii(const sal_Char *pModuleName, sal_Int32 nR
"sal.osl", "only either LAZY or NOW");
if (pModuleName)
{
#ifndef DISABLE_DYNLOADING
#ifdef ANDROID
(void) nRtldMode;
void *pLib = lo_dlopen(pModuleName);
......@@ -173,11 +175,6 @@ oslModule SAL_CALL osl_loadModuleAscii(const sal_Char *pModuleName, sal_Int32 nR
<< dlerror());
#endif
return ((oslModule)(pLib));
#else /* DISABLE_DYNLOADING */
(void) nRtldMode;
fprintf(stderr, "No DL Functions, osl_loadModuleAscii(%s) does nothing\n", pModuleName);
#endif /* DISABLE_DYNLOADING */
}
return NULL;
}
......@@ -212,6 +209,8 @@ oslModule osl_loadModuleRelativeAscii(
}
}
#endif // !DISABLE_DYNLOADING
/*****************************************************************************/
/* osl_getModuleHandle */
/*****************************************************************************/
......@@ -227,6 +226,8 @@ osl_getModuleHandle(rtl_uString *, oslModule *pResult)
return sal_True;
}
#ifndef DISABLE_DYNLOADING
/*****************************************************************************/
/* osl_unloadModule */
/*****************************************************************************/
......@@ -234,7 +235,6 @@ void SAL_CALL osl_unloadModule(oslModule hModule)
{
if (hModule)
{
#ifndef DISABLE_DYNLOADING
#ifdef ANDROID
int nRet = lo_dlclose(hModule);
#else
......@@ -242,10 +242,11 @@ void SAL_CALL osl_unloadModule(oslModule hModule)
#endif
SAL_INFO_IF(
nRet != 0, "sal.osl", "dlclose(" << hModule << "): " << dlerror());
#endif /* ifndef DISABLE_DYNLOADING */
}
}
#endif // !DISABLE_DYNLOADING
/*****************************************************************************/
/* osl_getSymbol */
/*****************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment