From 6298104cef47fa7486e5850c563220b1dbaf8b6a Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Thu, 11 Dec 2008 13:10:39 +0000 Subject: 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 --- pyuno/source/module/pyuno_dlopenwrapper.c | 33 +++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'pyuno') 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 + +#include +#include + +#ifdef LINUX +# ifndef __USE_GNU +# define __USE_GNU +# endif +#endif #include -#include 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) (); + } } } -- cgit