summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-08-29 14:16:04 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:48:40 +0100
commitfc86fdf6b44ae6814e99dd3b5e878191d63c16a0 (patch)
treed94bfc4bbd3eb7773047f7a3c2c1b0e8c66dc7dc /vcl
parent0a9ab848a66045043770d8d6a8ca70129e3bd1ce (diff)
GetProcAddress doesn't work like dlsym with executable's handle
underlying GetProcAddress on windows, unlike dlsym, doesn't search through all loaded .dlls searching for the symbol when given the default module. So load the module by name. Change-Id: I148250c9d8dd5aa2b802581d049533f2c5e83caf
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/builder.cxx26
1 files changed, 21 insertions, 5 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index c45494fce0d6..fdf6a49cb10c 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -26,7 +26,7 @@
* instead of those above.
*/
-#include <osl/module.h>
+#include <osl/module.hxx>
#include <vcl/builder.hxx>
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
@@ -342,6 +342,8 @@ bool VclBuilder::extractModel(const rtl::OString &id, stringmap &rMap)
return false;
}
+extern "C" { static void SAL_CALL thisModule() {} }
+
Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const rtl::OString &id, stringmap &rMap)
{
bool bIsPlaceHolder = name.isEmpty();
@@ -472,10 +474,24 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const
pWindow = new Window(pParent);
else
{
- rtl::OString sFunction = rtl::OString("make") + name;
- customMakeWidget pFunction = (customMakeWidget)osl_getAsciiFunctionSymbol(NULL, sFunction.getStr());
- if (pFunction)
- pWindow = (*pFunction)(pParent);
+ sal_Int32 nDelim = name.indexOf(':');
+ if (nDelim != -1)
+ {
+ rtl::OUStringBuffer sModule;
+#ifdef SAL_DLLPREFIX
+ sModule.append(SAL_DLLPREFIX);
+#endif
+ sModule.append(rtl::OStringToOUString(name.copy(0, nDelim), RTL_TEXTENCODING_UTF8));
+#ifdef SAL_DLLEXTENSION
+ sModule.append(SAL_DLLEXTENSION);
+#endif
+ rtl::OUString sFunction(rtl::OStringToOUString(rtl::OString("make") + name.copy(nDelim+1), RTL_TEXTENCODING_UTF8));
+ osl::Module aModule;
+ aModule.loadRelative(&thisModule, sModule.makeStringAndClear());
+ customMakeWidget pFunction = (customMakeWidget)aModule.getFunctionSymbol(sFunction);
+ if (pFunction)
+ pWindow = (*pFunction)(pParent);
+ }
}
if (!pWindow)
fprintf(stderr, "TO-DO, implement %s or add a make%s function\n", name.getStr(), name.getStr());