#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;
}
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
}
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;
*handle = dllhandle;
return true;
+#else
+ return false;
+#endif
}
void Sys_UnloadLibrary (dllhandle_t* handle)
{
+#ifdef SUPPORTDLL
if (handle == NULL || *handle == NULL)
return;
#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
}