Lines Matching defs:dll
166 CRDLL *dll;
229 dll = (CRDLL *) crAlloc( sizeof( CRDLL ) );
230 dll->name = crStrdup( dllname );
233 dll->hinstLib = LoadLibraryW( szwPath );
234 if (!dll->hinstLib)
236 crError("failed to load dll %s", dllname);
241 dll->type = get_dll_type( dllname );
244 switch( dll->type ) {
246 dll->hinstLib = LoadFramework( dllname );
251 dll->hinstLib = LoadBundle( dllname );
257 dll->hinstLib = (void*)NSAddImage( dllname, NSADDIMAGE_OPTION_RETURN_ON_ERROR );
260 dll->hinstLib = dlopen( dllname, RTLD_LAZY | RTLD_GLOBAL );
262 dll->hinstLib = dlopen( dllname, RTLD_LAZY | RTLD_LOCAL );
268 dll->hinstLib = NULL;
274 dll->hinstLib = dlopen( dllname, RTLD_LAZY | RTLD_GLOBAL );
276 dll->hinstLib = dlopen( dllname, RTLD_LAZY );
282 if (!dll->hinstLib)
290 return dll;
293 CRDLLFunc crDLLGetNoError( CRDLL *dll, const char *symname )
296 return (CRDLLFunc) GetProcAddress( dll->hinstLib, symname );
300 if( dll->type == CR_DLL_FRAMEWORK )
301 return (CRDLLFunc) CFBundleGetFunctionPointerForName( (CFBundleRef) dll->hinstLib, CFStringCreateWithCStringNoCopy(NULL, symname, CFStringGetSystemEncoding(), NULL) );
303 if( dll->type == CR_DLL_DYLIB )
305 nssym = NSLookupSymbolInImage( dll->hinstLib, symname, NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR );
307 return (CRDLLFunc) dlsym( dll->hinstLib, symname );
310 nssym = NSLookupSymbolInModule( dll->hinstLib, symname );
317 if( dll->type == CR_DLL_DYLIB )
318 nssym = NSLookupSymbolInImage( dll->hinstLib, name, NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR );
320 nssym = NSLookupSymbolInModule( dll->hinstLib, name );
326 return (CRDLLFunc) dlsym( dll->hinstLib, symname );
332 CRDLLFunc crDLLGet( CRDLL *dll, const char *symname )
334 CRDLLFunc data = crDLLGetNoError( dll, symname );
338 crWarning( "Couldn't get symbol \"%s\" in \"%s\"", symname, dll->name );
343 void crDLLClose( CRDLL *dll )
347 if (!dll) return;
350 FreeLibrary( dll->hinstLib );
352 switch( dll->type ) {
354 CFBundleUnloadExecutable( dll->hinstLib );
355 CFRelease(dll->hinstLib);
356 dll->hinstLib = NULL;
361 dlclose( dll->hinstLib );
366 NSUnLinkModule( (NSModule) dll->hinstLib, 0L );
377 if (strncmp(dll->name, "libGL", 5))
379 dll_err = dlclose( dll->hinstLib );
385 crWarning("Error closing DLL %s\n",dll->name);
387 crFree( dll->name );
388 crFree( dll );