Lines 95-100
Link Here
|
95 |
oslModule SAL_CALL osl_psz_loadModule(const sal_Char *pszModuleName, sal_Int32 nRtldMode); |
95 |
oslModule SAL_CALL osl_psz_loadModule(const sal_Char *pszModuleName, sal_Int32 nRtldMode); |
96 |
void* SAL_CALL osl_psz_getSymbol(oslModule hModule, const sal_Char* pszSymbolName); |
96 |
void* SAL_CALL osl_psz_getSymbol(oslModule hModule, const sal_Char* pszSymbolName); |
97 |
|
97 |
|
|
|
98 |
oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl(rtl_uString ** ppFileURL); |
99 |
|
98 |
/*****************************************************************************/ |
100 |
/*****************************************************************************/ |
99 |
/* osl_loadModule */ |
101 |
/* osl_loadModule */ |
100 |
/*****************************************************************************/ |
102 |
/*****************************************************************************/ |
Lines 116-123
Link Here
|
116 |
|
118 |
|
117 |
if (UnicodeToText(buffer, PATH_MAX, ustrTmp->buffer, ustrTmp->length)) |
119 |
if (UnicodeToText(buffer, PATH_MAX, ustrTmp->buffer, ustrTmp->length)) |
118 |
pModule = osl_psz_loadModule(buffer, nRtldMode); |
120 |
pModule = osl_psz_loadModule(buffer, nRtldMode); |
|
|
121 |
|
122 |
if (!pModule && (0 == strchr(buffer, '/'))) |
123 |
{ |
124 |
rtl_uString* ustrExecutableFile = NULL; |
125 |
|
126 |
if (osl_Process_E_None == osl_bootstrap_getExecutableFile_Impl(&ustrExecutableFile)) |
127 |
{ |
128 |
sal_Int32 n = rtl_ustr_lastIndexOfChar(ustrExecutableFile->buffer, (sal_Unicode) '/'); |
129 |
rtl_uString_newReplaceStrAt(&ustrTmp, ustrExecutableFile, n + 1, ustrExecutableFile->length - n - 1, ustrModuleName); |
130 |
pModule = osl_loadModule(ustrTmp, nRtldMode); |
131 |
rtl_uString_release(ustrExecutableFile); |
132 |
} |
133 |
} |
134 |
rtl_uString_release(ustrTmp); |
119 |
} |
135 |
} |
120 |
rtl_uString_release(ustrTmp); |
|
|
121 |
|
136 |
|
122 |
return pModule; |
137 |
return pModule; |
123 |
} |
138 |
} |
Lines 134-156
Link Here
|
134 |
{ |
149 |
{ |
135 |
#ifndef NO_DL_FUNCTIONS |
150 |
#ifndef NO_DL_FUNCTIONS |
136 |
void* pLib = dlopen(pszModuleName, rtld_mode); |
151 |
void* pLib = dlopen(pszModuleName, rtld_mode); |
137 |
if ((pLib == 0) && (strchr (pszModuleName, '/') == 0)) |
|
|
138 |
{ |
139 |
/* module w/o pathname not found, try cwd as last chance */ |
140 |
char buffer[PATH_MAX]; |
141 |
|
142 |
buffer[0] = '.', buffer[1] = '/', buffer[2] = '\0'; |
143 |
strncat (buffer, pszModuleName, sizeof(buffer) - 2); |
144 |
|
145 |
pLib = dlopen(buffer, rtld_mode); |
146 |
} |
147 |
|
152 |
|
148 |
#if OSL_DEBUG_LEVEL > 1 |
153 |
#if OSL_DEBUG_LEVEL > 1 |
149 |
if (pLib == 0) |
154 |
if (pLib == 0) |
150 |
{ |
155 |
OSL_TRACE("Error osl_loadModule: %s\n", dlerror()); |
151 |
/* module not found, give up */ |
|
|
152 |
fprintf (stderr, "Error osl_loadModule: %s\n", dlerror()); |
153 |
} |
154 |
#endif /* OSL_DEBUG_LEVEL */ |
156 |
#endif /* OSL_DEBUG_LEVEL */ |
155 |
|
157 |
|
156 |
return ((oslModule)(pLib)); |
158 |
return ((oslModule)(pLib)); |