Browse Source

steps towards cross compiling, relates #159

Stasik0 10 years ago
parent
commit
26f4fa8a2f
3 changed files with 6 additions and 5 deletions
  1. 1 1
      examples/networklayer_tcp.c
  2. 3 2
      src/ua_types.c
  3. 2 2
      src/ua_util.h

+ 1 - 1
examples/networklayer_tcp.c

@@ -8,7 +8,7 @@
 #include <malloc.h>
 #include <winsock2.h>
 #include <sys/types.h>
-#include <Windows.h>
+#include <windows.h>
 #include <ws2tcpip.h>
 #define CLOSESOCKET(S) closesocket(S)
 #else

+ 3 - 2
src/ua_types.c

@@ -13,7 +13,7 @@
 
 #include "ua_util.h"
 
-#ifdef _MSC_VER
+#ifdef _WIN32
 #define RAND(SEED) (UA_UInt32)rand()
 #else
 #define RAND(SEED) (UA_UInt32)rand_r(SEED)
@@ -266,8 +266,9 @@ UA_TYPE_AS(UA_DateTime, UA_Int64)
 #define HUNDRED_NANOSEC_PER_USEC 10LL
 #define HUNDRED_NANOSEC_PER_SEC (HUNDRED_NANOSEC_PER_USEC * 1000000LL)
 
-#ifdef _MSC_VER
+#ifdef _WIN32
 static const unsigned __int64 epoch = 116444736000000000;
+int gettimeofday(struct timeval *tp, struct timezone *tzp);
 int gettimeofday(struct timeval *tp, struct timezone *tzp) {
     FILETIME       ft;
     SYSTEMTIME     st;

+ 2 - 2
src/ua_util.h

@@ -4,7 +4,7 @@
 #include <assert.h> // assert
 
 #include <stddef.h> /* Needed for sys/queue.h */
-#ifndef WIN32
+#ifndef _WIN32
 #include <sys/queue.h>
 #include <alloca.h>
 #else
@@ -29,7 +29,7 @@ void * UA_realloc(void *ptr, UA_UInt32 size);
 void UA_memcpy(void *dst, void const *src, UA_UInt32 size);
 void * UA_memset(void *ptr, UA_Int32 value, UA_UInt32 size);
 
-#ifdef WIN32
+#ifdef _WIN32
 #define UA_alloca(SIZE) _alloca(SIZE)
 #else
 #define UA_alloca(SIZE) alloca(SIZE)