summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-12-11 13:10:39 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-12-11 13:10:39 +0000
commit5adcb9f210708e0a4147578062844d6baed7a38b (patch)
treee1f2455fd2b40b1572ae6cac097612aa505931bb /pyuno
parentd6ece1889bc1759d6103c03b3955e48cd64d05af (diff)
CWS-TOOLING: integrate CWS jsc312
2008-12-04 17:08:20 +0100 jsc r264858 : #i96902# update reference rdb 2008-12-04 17:06:34 +0100 jsc r264857 : #i96902# update reference rdb 2008-11-28 14:54:24 +0100 jsc r264556 : #i96671# correct location of generated scripts 2008-11-28 14:29:30 +0100 jsc r264554 : #92661# minor changes 2008-11-28 09:36:27 +0100 jsc r264527 : #92661# minor optimizations 2008-11-27 11:32:24 +0100 jsc r264470 : #92661# retrieve lib path and load related library full qualified 2008-11-18 09:08:22 +0100 jsc r263745 : #i93980# change docu, insert note that regview and regmerge are part of the ure 2008-11-18 09:05:12 +0100 jsc r263744 : #i93980# remove regview and regmerge 2008-11-18 08:57:09 +0100 jsc r263743 : #i93981# insert SDK rpath link option for regcompare 2008-11-18 08:55:08 +0100 jsc r263742 : #i93981# insert SDK rpath link option 2008-11-17 16:26:25 +0100 jsc r263727 : #i96055# correct brackets
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/module/pyuno_dlopenwrapper.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/pyuno/source/module/pyuno_dlopenwrapper.c b/pyuno/source/module/pyuno_dlopenwrapper.c
index 2c51cf9af..ea71fee8c 100644
--- a/pyuno/source/module/pyuno_dlopenwrapper.c
+++ b/pyuno/source/module/pyuno_dlopenwrapper.c
@@ -27,16 +27,37 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
+#include <rtl/string.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef LINUX
+# ifndef __USE_GNU
+# define __USE_GNU
+# endif
+#endif
#include <dlfcn.h>
-#include <sal/config.h>
void initpyuno ()
{
+ Dl_info dl_info;
void (*func)(void);
- void* h = dlopen (SAL_DLLPREFIX "pyuno" SAL_DLLEXTENSION , RTLD_NOW | RTLD_GLOBAL);
- if( h )
- {
- func = (void (*)())dlsym (h, "initpyuno");
- (func) ();
- }
+
+ if (dladdr((void*)&initpyuno, &dl_info) != 0) {
+ void* h = 0;
+ size_t len = strrchr(dl_info.dli_fname, '/') - dl_info.dli_fname + 1;
+ char* libname = malloc(len + RTL_CONSTASCII_LENGTH( SAL_DLLPREFIX "pyuno" SAL_DLLEXTENSION ) + 1);
+ strncpy(libname, dl_info.dli_fname, len);
+ strcpy(libname + (len), SAL_DLLPREFIX "pyuno" SAL_DLLEXTENSION);
+
+ h = dlopen (libname, RTLD_NOW | RTLD_GLOBAL);
+ free(libname);
+ if( h )
+ {
+ func = (void (*)())dlsym (h, "initpyuno");
+ (func) ();
+ }
+ }
}