Browse Source

Add mingw compatibility.

master
samr7 13 years ago
parent
commit
615600b224
  1. 19
      winglue.c

19
winglue.c

@ -84,7 +84,6 @@ gettimeofday(struct timeval *tv, struct timezone *tz)
{ {
FILETIME ft; FILETIME ft;
unsigned __int64 tmpres = 0; unsigned __int64 tmpres = 0;
static int tzflag;
if (NULL != tv) { if (NULL != tv) {
GetSystemTimeAsFileTime(&ft); GetSystemTimeAsFileTime(&ft);
@ -202,12 +201,20 @@ int getopt(int argc, TCHAR *argv[], TCHAR *optstring)
* its process attach function gets called before main(). * its process attach function gets called before main().
*/ */
#if defined(PTW32_STATIC_LIB) #if defined(PTW32_STATIC_LIB)
#pragma section(".CRT$XIC",long,read)
int __cdecl __initptw32(void); int __cdecl __initptw32(void);
#define _CRTALLOC(x) __declspec(allocate(x))
_CRTALLOC(".CRT$XIC") #if defined(_MSC_VER)
static int (*pinit)(void) = __initptw32; #pragma section(".CRT$XIC",long,read)
int __cdecl __declspec(allocate(".CRT$XIC")) static int (*pinit)(void) = __initptw32;
#define CONSTRUCTOR_TYPE __cdecl
#elif defined(__GNUC__)
#define CONSTRUCTOR_TYPE __cdecl __attribute__((constructor))
#else
#error "Unknown compiler -- can't mark constructor"
#endif
int CONSTRUCTOR_TYPE
__initptw32(void) __initptw32(void)
{ {
pthread_win32_process_attach_np(); pthread_win32_process_attach_np();

Loading…
Cancel
Save