diff options
author | Tor Lillqvist <tml@iki.fi> | 2012-10-07 07:52:26 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-10-07 07:59:15 +0300 |
commit | 97593ae24a98daca89fad176dc2492e582b3a821 (patch) | |
tree | f52189545a5c5ffbc7cece7bca595b2cd18c9cc0 /sc | |
parent | 1691752dd29d661552700d9bcac5d3a3953fb91a (diff) |
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
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/callform.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scabstdlg.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scuiexp.cxx | 4 |
3 files changed, 39 insertions, 1 deletions
diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx index 5d20ad29c2f2..8ba120bf861b 100644 --- a/sc/source/core/tool/callform.cxx +++ b/sc/source/core/tool/callform.cxx @@ -89,7 +89,14 @@ friend class ModuleCollection; osl::Module* pInstance; public: ModuleData(const rtl::OUString& rStr, osl::Module* pInst) : aName(rStr), pInstance(pInst) {} - ModuleData(const ModuleData& rData) : aName(rData.aName) {pInstance = new osl::Module(aName);} + ModuleData(const ModuleData& rData) : aName(rData.aName) + { +#ifndef DISABLE_DYNLOADING + pInstance = new osl::Module(aName); +#else + pInstance = NULL; +#endif + } ~ModuleData() { delete pInstance; } const rtl::OUString& GetName() const { return aName; } @@ -174,6 +181,10 @@ ModuleCollection aModuleCollection; bool InitExternalFunc(const rtl::OUString& rModuleName) { +#ifdef DISABLE_DYNLOADING + (void) rModuleName; + return false; +#else // Module already loaded? const ModuleData* pTemp = aModuleCollection.findByName(rModuleName); if (pTemp) @@ -252,6 +263,7 @@ bool InitExternalFunc(const rtl::OUString& rModuleName) else delete pLib; return bRet; +#endif } //------------------------------------------------------------------------ @@ -265,6 +277,10 @@ void ExitExternalFunc() bool FuncData::Call(void** ppParam) const { +#ifdef DISABLE_DYNLOADING + (void) ppParam; + return false; +#else bool bRet = false; osl::Module* pLib = pModuleData->GetInstance(); FARPROC fProc = (FARPROC)pLib->getFunctionSymbol(aFuncName); @@ -354,12 +370,17 @@ bool FuncData::Call(void** ppParam) const } } return bRet; +#endif } //------------------------------------------------------------------------ bool FuncData::Unadvice( double nHandle ) { +#ifdef DISABLE_DYNLOADING + (void) nHandle; + return false; +#else bool bRet = false; osl::Module* pLib = pModuleData->GetInstance(); FARPROC fProc = (FARPROC)pLib->getFunctionSymbol(UNADVICE); @@ -369,6 +390,7 @@ bool FuncData::Unadvice( double nHandle ) bRet = true; } return bRet; +#endif } //------------------------------------------------------------------------ diff --git a/sc/source/ui/attrdlg/scabstdlg.cxx b/sc/source/ui/attrdlg/scabstdlg.cxx index 98b0efae6515..654fb76df9b4 100644 --- a/sc/source/ui/attrdlg/scabstdlg.cxx +++ b/sc/source/ui/attrdlg/scabstdlg.cxx @@ -36,10 +36,19 @@ using ::rtl::OUStringBuffer; typedef ScAbstractDialogFactory* (__LOADONCALLAPI *ScFuncPtrCreateDialogFactory)(); +#ifndef DISABLE_DYNLOADING + extern "C" { static void SAL_CALL thisModule() {} } +#else + +extern "C" ScAbstractDialogFactory* ScCreateDialogFactory(); + +#endif + ScAbstractDialogFactory* ScAbstractDialogFactory::Create() { +#ifndef DISABLE_DYNLOADING ScFuncPtrCreateDialogFactory fp = 0; static ::osl::Module aDialogLibrary; @@ -53,6 +62,9 @@ ScAbstractDialogFactory* ScAbstractDialogFactory::Create() if ( fp ) return fp(); return 0; +#else + return ScCreateDialogFactory(); +#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/attrdlg/scuiexp.cxx b/sc/source/ui/attrdlg/scuiexp.cxx index c2581ea7b578..77e5b2e9f2ea 100644 --- a/sc/source/ui/attrdlg/scuiexp.cxx +++ b/sc/source/ui/attrdlg/scuiexp.cxx @@ -36,6 +36,10 @@ namespace scui } } +#ifdef DISABLE_DYNLOADING +#define CreateDialogFactory ScCreateDialogFactory +#endif + extern "C" { SAL_DLLPUBLIC_EXPORT ScAbstractDialogFactory* CreateDialogFactory() |