]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_shared.c
changed Cg shader support to check DP_CG_LIBDIR instead of trying to
[xonotic/darkplaces.git] / sys_shared.c
index e332f23b110246310393d4dd5d5fbc8cd2bb7d93..a52b9426cd5b769b36e08a88c86c1f31a04f9042 100644 (file)
@@ -1,16 +1,27 @@
 #include "quakedef.h"
+
+#define SUPPORTDLL
+
 # include <time.h>
 #ifndef WIN32
 # include <unistd.h>
 # include <fcntl.h>
+#ifdef SUPPORTDLL
 # include <dlfcn.h>
 #endif
+#endif
 
 static char sys_timestring[128];
 char *Sys_TimeString(const char *timeformat)
 {
        time_t mytime = time(NULL);
+#if _MSC_VER >= 1400
+       struct tm mytm;
+       localtime_s(&mytm, &mytime);
+       strftime(sys_timestring, sizeof(sys_timestring), timeformat, &mytm);
+#else
        strftime(sys_timestring, sizeof(sys_timestring), timeformat, localtime(&mytime));
+#endif
        return sys_timestring;
 }
 
@@ -25,10 +36,16 @@ void Sys_Quit (int returnvalue)
        exit(returnvalue);
 }
 
+#if defined(__linux__) || defined(__FreeBSD__)
+#ifdef __cplusplus
+extern "C"
+#endif
+int moncontrol(int);
+#endif
+
 void Sys_AllowProfiling(qboolean enable)
 {
 #if defined(__linux__) || defined(__FreeBSD__)
-int moncontrol(int);
        moncontrol(enable);
 #endif
 }
@@ -44,6 +61,7 @@ DLL MANAGEMENT
 
 qboolean Sys_LoadLibrary (const char** dllnames, dllhandle_t* handle, const dllfunction_t *fcts)
 {
+#ifdef SUPPORTDLL
        const dllfunction_t *func;
        dllhandle_t dllhandle = 0;
        unsigned int i;
@@ -131,10 +149,14 @@ notfound:
 
        *handle = dllhandle;
        return true;
+#else
+       return false;
+#endif
 }
 
 void Sys_UnloadLibrary (dllhandle_t* handle)
 {
+#ifdef SUPPORTDLL
        if (handle == NULL || *handle == NULL)
                return;
 
@@ -145,14 +167,19 @@ void Sys_UnloadLibrary (dllhandle_t* handle)
 #endif
 
        *handle = NULL;
+#endif
 }
 
 void* Sys_GetProcAddress (dllhandle_t handle, const char* name)
 {
+#ifdef SUPPORTDLL
 #ifdef WIN32
        return (void *)GetProcAddress (handle, name);
 #else
        return (void *)dlsym (handle, name);
 #endif
+#else
+       return NULL;
+#endif
 }