MCPcopy Index your code
hub / github.com/MapServer/MapServer / msGetSymbol

Function msGetSymbol

mapcpl.c:162–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 */
161
162void *msGetSymbol( const char * pszLibrary, const char * pszSymbolName )
163{
164 void *pLibrary;
165 void *pSymbol;
166
167 pLibrary = dlopen(pszLibrary, RTLD_LAZY);
168 if( pLibrary == NULL )
169 {
170 msSetError(MS_MISCERR,
171 "Dynamic loading failed: %s",
172 "msGetSymbol()", dlerror());
173 return NULL;
174 }
175
176 pSymbol = dlsym( pLibrary, pszSymbolName );
177
178#if (defined(__APPLE__) && defined(__MACH__))
179 /* On mach-o systems, C symbols have a leading underscore and depending
180 * on how dlcompat is configured it may or may not add the leading
181 * underscore. So if dlsym() fails add an underscore and try again.
182 */
183 if( pSymbol == NULL )
184 {
185 char withUnder[strlen(pszSymbolName) + 2];
186 withUnder[0] = '_'; withUnder[1] = 0;
187 strcat(withUnder, pszSymbolName);
188 pSymbol = dlsym( pLibrary, withUnder );
189 }
190#endif
191
192 if( pSymbol == NULL )
193 {
194 msSetError(MS_MISCERR,
195 "Dynamic loading failed: %s",
196 "msGetSymbol()", dlerror());
197 return NULL;
198 }
199
200 return( pSymbol );
201}
202
203#endif /* def __unix__ && defined(HAVE_DLFCN_H) */
204

Callers 1

loadCustomLayerDLLFunction · 0.85

Calls 1

msSetErrorFunction · 0.85

Tested by

no test coverage detected