]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_shared.c
merged dll handling code into sys_shared.c because the code in sys_linux.c was for...
[xonotic/darkplaces.git] / sys_shared.c
index 3d666e922ae258c5772a61b29e5e665689abd179..465b322ef71a5b9e82f0810967112051f27fb023 100644 (file)
@@ -118,3 +118,42 @@ void Sys_Shared_LateInit(void)
 {
 }
 
+/*
+===============================================================================
+
+DLL MANAGEMENT
+
+===============================================================================
+*/
+
+#ifndef WIN32
+#include <dlfcn.h>
+#endif
+
+dllhandle_t Sys_LoadLibrary (const char* name)
+{
+#ifdef WIN32
+       return LoadLibrary (name);
+#else
+       return dlopen (name, RTLD_LAZY);
+#endif
+}
+
+void Sys_UnloadLibrary (dllhandle_t handle)
+{
+#ifdef WIN32
+       FreeLibrary (handle);
+#else
+       dlclose (handle);
+#endif
+}
+
+void* Sys_GetProcAddress (dllhandle_t handle, const char* name)
+{
+#ifdef WIN32
+       return (void *)GetProcAddress (handle, name);
+#else
+       return (void *)dlsym (handle, name);
+#endif
+}
+