Browse Source

Export functions only for a shared library

NX 6 years ago
parent
commit
7f0178059f
3 changed files with 4 additions and 6 deletions
  1. 2 1
      Source/Native/CMakeLists.txt
  2. 0 1
      Source/Native/enet.c
  3. 2 4
      Source/Native/enet.h

+ 2 - 1
Source/Native/CMakeLists.txt

@@ -24,9 +24,10 @@ if (ENET_STATIC)
 endif()
 
 if (ENET_SHARED)
+    add_definitions(-DENET_DLL)
     add_library(enet SHARED enet.c ${SOURCES})
 
     if (WIN32)
         target_link_libraries(enet winmm ws2_32)
     endif()
-endif()
+endif()

+ 0 - 1
Source/Native/enet.c

@@ -22,5 +22,4 @@
  */
 
 #define ENET_IMPLEMENTATION
-#define ENET_DLL
 #include "enet.h"

+ 2 - 4
Source/Native/enet.h

@@ -169,8 +169,6 @@
 	#define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
 #endif
 
-/* Macros */
-
 #define ENET_HOST_ANY in6addr_any
 #define ENET_PORT_ANY 0
 #define ENET_HOST_SIZE 1025
@@ -477,7 +475,7 @@ extern "C" {
 		uint16_t port;
 	} ENetAddress;
 
-	#define in6_equal(in6_addr_a, in6_addr_b) (memcmp(&in6_addr_a, &in6_addr_b, sizeof(struct in6_addr)) == 0)
+	#define in6_equal(a, b) (memcmp(&a, &b, sizeof(struct in6_addr)) == 0)
 
 	typedef enum _ENetPacketFlag {
 		ENET_PACKET_FLAG_NONE                  = 0,
@@ -5164,4 +5162,4 @@ extern "C" {
 }
 #endif
 #endif
-#endif
+#endif