]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_linux.c
another bugfix for WORKINGLQUAKE code
[xonotic/darkplaces.git] / sys_linux.c
index 0dc1ce9e61ae8da4f4dc1263115945178c7147b2..1e675e4799a5865f88cba7deb9421d6d4f0d5d4e 100644 (file)
 #include <errno.h>
 #include <time.h>
 
+#include <dlfcn.h>
+
 #include "quakedef.h"
 
-char *basedir = ".";
-#if CACHEENABLE
-char *cachedir = "/tmp";
-#endif
+/*
+===============================================================================
+
+DLL MANAGEMENT
+
+===============================================================================
+*/
+
+dllhandle_t Sys_LoadLibrary (const char* name)
+{
+       return dlopen (name, RTLD_LAZY);
+}
+
+void Sys_UnloadLibrary (dllhandle_t handle)
+{
+       dlclose (handle);
+}
+
+void* Sys_GetProcAddress (dllhandle_t handle, const char* name)
+{
+       return (void *)dlsym (handle, name);
+}
+
 
 // =======================================================================
 // General routines
@@ -144,17 +165,14 @@ void Sys_Sleep(void)
        usleep(1);
 }
 
-int main (int c, char **v)
+int main (int argc, const char **argv)
 {
        double frameoldtime, framenewtime;
 
        signal(SIGFPE, SIG_IGN);
 
-       memset(&host_parms, 0, sizeof(host_parms));
-
-       host_parms.argc = c;
-       host_parms.argv = v;
-       host_parms.basedir = basedir;
+       com_argc = argc;
+       com_argv = argv;
 
        fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);