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
commit6298104cef47fa7486e5850c563220b1dbaf8b6a (patch)
treef28bc819e0b5623a17ee1c6ac867946f2c0d11c3 /pyuno
parent392fb0681022a7fa4b04003f7267cdcf96873a60 (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.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/pyuno/source/module/pyuno_dlopenwrapper.c b/pyuno/source/module/pyuno_dlopenwrapper.c
index 9a911b56d57f..71ddaaa44f6f 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) ();
+ }
}
}