+ // Try every possible name
+ Con_Printf ("Trying to load library...");
+ for (i = 0; dllnames[i] != NULL; i++)
+ {
+ Con_Printf (" \"%s\"", dllnames[i]);
+#ifdef WIN32
+ dllhandle = LoadLibrary (dllnames[i]);
+#else
+ dllhandle = dlopen (dllnames[i], RTLD_LAZY | RTLD_GLOBAL);
+#endif
+ if (dllhandle)
+ break;
+ }
+
+ // see if the names can be loaded relative to the executable path
+ // (this is for Mac OSX which does not check next to the executable)
+ if (!dllhandle && strrchr(com_argv[0], '/'))
+ {
+ char path[MAX_OSPATH];
+ strlcpy(path, com_argv[0], sizeof(path));
+ strrchr(path, '/')[1] = 0;
+ for (i = 0; dllnames[i] != NULL; i++)
+ {
+ char temp[MAX_OSPATH];
+ strlcpy(temp, path, sizeof(temp));
+ strlcat(temp, dllnames[i], sizeof(temp));
+ Con_Printf (" \"%s\"", temp);