Bladeren bron

fixed dll defines

Vladyslav Hrytsenko 6 jaren geleden
bovenliggende
commit
df215a1b54
3 gewijzigde bestanden met toevoegingen van 11 en 2 verwijderingen
  1. 4 0
      CMakeLists.txt
  2. 3 2
      include/enet.h
  3. 4 0
      test/library.c

+ 4 - 0
CMakeLists.txt

@@ -6,6 +6,7 @@ project(enet)
 include(CheckFunctionExists)
 include(CheckStructHasMember)
 include(CheckTypeSize)
+
 check_function_exists("fcntl" HAS_FCNTL)
 check_function_exists("poll" HAS_POLL)
 check_function_exists("getaddrinfo" HAS_GETADDRINFO)
@@ -14,10 +15,13 @@ check_function_exists("gethostbyname_r" HAS_GETHOSTBYNAME_R)
 check_function_exists("gethostbyaddr_r" HAS_GETHOSTBYADDR_R)
 check_function_exists("inet_pton" HAS_INET_PTON)
 check_function_exists("inet_ntop" HAS_INET_NTOP)
+
 check_struct_has_member("struct msghdr" "msg_flags" "sys/types.h;sys/socket.h" HAS_MSGHDR_FLAGS)
+
 set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h" "sys/socket.h")
 check_type_size("socklen_t" HAS_SOCKLEN_T BUILTIN_TYPES_ONLY)
 unset(CMAKE_EXTRA_INCLUDE_FILES)
+
 if(MSVC)
 	add_definitions(-W3)
 else()

+ 3 - 2
include/enet.h

@@ -52,6 +52,7 @@
     #pragma comment(lib, "winmm.lib")
     #endif
 
+    #include <winsock2.h>
     #include <ws2tcpip.h>
 
     typedef SOCKET ENetSocket;
@@ -72,11 +73,11 @@
     #define ENET_CALLBACK __cdecl
 
     #ifdef ENET_DLL
-    #ifdef ENET_BUILDING_LIB
+    #ifdef ENET_IMPLEMENTATION
     #define ENET_API __declspec( dllexport )
     #else
     #define ENET_API __declspec( dllimport )
-    #endif // ENET_BUILDING_LIB
+    #endif // ENET_IMPLEMENTATION
     #else
     #define ENET_API extern
     #endif // ENET_DLL

+ 4 - 0
test/library.c

@@ -0,0 +1,4 @@
+#define _WINSOCK_DEPRECATED_NO_WARNINGS
+#define ENET_IMPLEMENTATION
+#define ENET_DLL
+#include "enet.h"