summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-10-07 07:52:26 +0300
committerTor Lillqvist <tml@iki.fi>2012-10-07 07:59:15 +0300
commit97593ae24a98daca89fad176dc2492e582b3a821 (patch)
treef52189545a5c5ffbc7cece7bca595b2cd18c9cc0 /vcl
parent1691752dd29d661552700d9bcac5d3a3953fb91a (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 'vcl')
-rw-r--r--vcl/source/window/abstdlg.cxx8
-rw-r--r--vcl/source/window/builder.cxx12
2 files changed, 20 insertions, 0 deletions
diff --git a/vcl/source/window/abstdlg.cxx b/vcl/source/window/abstdlg.cxx
index 3186ba9bc2fe..6db6b95a8978 100644
--- a/vcl/source/window/abstdlg.cxx
+++ b/vcl/source/window/abstdlg.cxx
@@ -34,16 +34,24 @@
typedef VclAbstractDialogFactory* (__LOADONCALLAPI *FuncPtrCreateDialogFactory)();
+#ifndef DISABLE_DYNLOADING
extern "C" { static void SAL_CALL thisModule() {} }
+#else
+extern "C" VclAbstractDialogFactory* CreateDialogFactory();
+#endif
VclAbstractDialogFactory* VclAbstractDialogFactory::Create()
{
FuncPtrCreateDialogFactory fp = 0;
+#ifndef DISABLE_DYNLOADING
static ::osl::Module aDialogLibrary;
if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( CUI_DLL_NAME ),
SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) )
fp = ( VclAbstractDialogFactory* (__LOADONCALLAPI*)() )
aDialogLibrary.getFunctionSymbol( ::rtl::OUString("CreateDialogFactory") );
+#else
+ fp = CreateDialogFactory;
+#endif
if ( fp )
return fp();
return 0;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 1fdad861112b..86c06d109067 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -25,6 +25,10 @@
#include <svids.hrc>
#include <window.h>
+#ifdef DISABLE_DYNLOADING
+#include <dlfcn.h> // For RTLD_DEFAULT
+#endif
+
namespace
{
SymbolType mapStockToSymbol(OString sType)
@@ -474,7 +478,9 @@ bool VclBuilder::extractImage(const OString &id, stringmap &rMap)
return false;
}
+#ifndef DISABLE_DYNLOADING
extern "C" { static void SAL_CALL thisModule() {} }
+#endif
Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OString &id, stringmap &rMap)
{
@@ -664,6 +670,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
sal_Int32 nDelim = name.indexOf(':');
if (nDelim != -1)
{
+#ifndef DISABLE_DYNLOADING
OUStringBuffer sModule;
#ifdef SAL_DLLPREFIX
sModule.append(SAL_DLLPREFIX);
@@ -672,10 +679,15 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
#ifdef SAL_DLLEXTENSION
sModule.append(SAL_DLLEXTENSION);
#endif
+#endif
OUString sFunction(OStringToOUString(OString("make") + name.copy(nDelim+1), RTL_TEXTENCODING_UTF8));
+#ifndef DISABLE_DYNLOADING
osl::Module aModule;
aModule.loadRelative(&thisModule, sModule.makeStringAndClear());
customMakeWidget pFunction = (customMakeWidget)aModule.getFunctionSymbol(sFunction);
+#else
+ customMakeWidget pFunction = (customMakeWidget)osl_getFunctionSymbol((oslModule) RTLD_DEFAULT, sFunction.pData);
+#endif
if (pFunction)
pWindow = (*pFunction)(pParent, rMap);
}