minor preprocessor symbol name change

This commit is contained in:
Joseph Henry
2016-12-07 10:28:40 -08:00
parent 7090c8fe5b
commit 7753bf3059
3 changed files with 35 additions and 37 deletions

View File

@@ -65,14 +65,13 @@ namespace ZeroTier {
void close() { void close() {
#if defined(__STATIC__LWIP__) #if defined(__STATIC__LWIP__)
return; return;
#elif defined(__DYNAMIC_LWIP__) #elif defined(__DYNAMIC_STACK__)
dlclose(_libref); dlclose(_libref);
#endif #endif
} }
//void (*_netif_init)(void); //void (*_netif_init)(void);
Mutex _lock; Mutex _lock;
Mutex _lock_mem; Mutex _lock_mem;
@@ -80,34 +79,34 @@ namespace ZeroTier {
_libref(NULL) _libref(NULL)
{ {
#if defined(__ANDROID__) || defined(__UNITY_3D__) #if defined(__ANDROID__) || defined(__UNITY_3D__)
#define __STATIC_LWIP__ #define __STATIC_STACK__
#elif defined(__linux__) #elif defined(__linux__)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW); _libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW);
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include "TargetConditionals.h" #include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
#include "node/Mutex.hpp" #include "node/Mutex.hpp"
#define __STATIC_LWIP__ #define __STATIC_STACK__
// iOS Simulator or iOS device // iOS Simulator or iOS device
// Do nothing, symbols are statically-linked // Do nothing, symbols are statically-linked
#elif TARGET_OS_MAC && !defined(SDK_BUNDLED) #elif TARGET_OS_MAC && !defined(SDK_BUNDLED)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlopen(path, RTLD_NOW); _libref = dlopen(path, RTLD_NOW);
#else #else
#define __STATIC_LWIP__ #define __STATIC_STACK__
#endif #endif
#endif #endif
#ifdef __STATIC_LWIP__ // Set static references (for use in iOS) #ifdef __STATIC_STACK__ // Set static references (for use in iOS)
//_netif_init = (void(*)(void))&netif_init; //_netif_init = (void(*)(void))&netif_init;
#endif #endif
#ifdef __DYNAMIC_LWIP__ // Use dynamically-loaded symbols (for use in normal desktop applications) #ifdef __DYNAMIC_STACK__ // Use dynamically-loaded symbols (for use in normal desktop applications)
if(_libref == NULL) if(_libref == NULL)
DEBUG_ERROR("dlerror(): %s", dlerror()); DEBUG_ERROR("dlerror(): %s", dlerror());
@@ -124,7 +123,6 @@ namespace ZeroTier {
} }
//inline void __netif_init(void) throw() { Mutex::Lock _l(_lock); _netif_init(); } //inline void __netif_init(void) throw() { Mutex::Lock _l(_lock); _netif_init(); }
}; };
} // namespace ZeroTier } // namespace ZeroTier

View File

@@ -268,7 +268,7 @@ namespace ZeroTier {
void close() { void close() {
#if defined(__STATIC__LWIP__) #if defined(__STATIC__LWIP__)
return; return;
#elif defined(__DYNAMIC_LWIP__) #elif defined(__DYNAMIC_STACK__)
dlclose(_libref); dlclose(_libref);
#endif #endif
} }
@@ -334,28 +334,28 @@ namespace ZeroTier {
_libref(NULL) _libref(NULL)
{ {
#if defined(__ANDROID__) || defined(__UNITY_3D__) #if defined(__ANDROID__) || defined(__UNITY_3D__)
#define __STATIC_LWIP__ #define __STATIC_STACK__
#elif defined(__linux__) #elif defined(__linux__)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW); _libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW);
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include "TargetConditionals.h" #include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
#include "node/Mutex.hpp" #include "node/Mutex.hpp"
#define __STATIC_LWIP__ #define __STATIC_STACK__
// iOS Simulator or iOS device // iOS Simulator or iOS device
// Do nothing, symbols are statically-linked // Do nothing, symbols are statically-linked
#elif TARGET_OS_MAC && !defined(SDK_BUNDLED) #elif TARGET_OS_MAC && !defined(SDK_BUNDLED)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlopen(path, RTLD_NOW); _libref = dlopen(path, RTLD_NOW);
#else #else
#define __STATIC_LWIP__ #define __STATIC_STACK__
#endif #endif
#endif #endif
#ifdef __STATIC_LWIP__ // Set static references (for use in iOS) #ifdef __STATIC_STACK__ // Set static references (for use in iOS)
#if defined(SDK_IPV4) #if defined(SDK_IPV4)
_etharp_output = (err_t(*)(ETHARP_OUTPUT_SIG))&etharp_output; _etharp_output = (err_t(*)(ETHARP_OUTPUT_SIG))&etharp_output;
@@ -407,7 +407,7 @@ namespace ZeroTier {
#endif #endif
#ifdef __DYNAMIC_LWIP__ // Use dynamically-loaded symbols (for use in normal desktop applications) #ifdef __DYNAMIC_STACK__ // Use dynamically-loaded symbols (for use in normal desktop applications)
if(_libref == NULL) if(_libref == NULL)
DEBUG_ERROR("dlerror(): %s", dlerror()); DEBUG_ERROR("dlerror(): %s", dlerror());

View File

@@ -134,7 +134,7 @@ namespace ZeroTier {
void close() { void close() {
#if defined(__STATIC__LWIP__) #if defined(__STATIC__LWIP__)
return; return;
#elif defined(__DYNAMIC_LWIP__) #elif defined(__DYNAMIC_STACK__)
dlclose(_libref); dlclose(_libref);
#endif #endif
} }
@@ -173,28 +173,28 @@ namespace ZeroTier {
_libref(NULL) _libref(NULL)
{ {
#if defined(__ANDROID__) || defined(__UNITY_3D__) #if defined(__ANDROID__) || defined(__UNITY_3D__)
#define __STATIC_LWIP__ #define __STATIC_STACK__
#elif defined(__linux__) #elif defined(__linux__)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW); _libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW);
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include "TargetConditionals.h" #include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
#include "node/Mutex.hpp" #include "node/Mutex.hpp"
#define __STATIC_LWIP__ #define __STATIC_STACK__
// iOS Simulator or iOS device // iOS Simulator or iOS device
// Do nothing, symbols are statically-linked // Do nothing, symbols are statically-linked
#elif TARGET_OS_MAC && !defined(SDK_BUNDLED) #elif TARGET_OS_MAC && !defined(SDK_BUNDLED)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlopen(path, RTLD_NOW); _libref = dlopen(path, RTLD_NOW);
#else #else
#define __STATIC_LWIP__ #define __STATIC_STACK__
#endif #endif
#endif #endif
#ifdef __STATIC_LWIP__ // Set static references (for use in iOS) #ifdef __STATIC_STACK__ // Set static references (for use in iOS)
_pico_stack_init = (void(*)(void))&pico_stack_init; _pico_stack_init = (void(*)(void))&pico_stack_init;
_pico_stack_tick = (void(*)(void))&pico_stack_tick; _pico_stack_tick = (void(*)(void))&pico_stack_tick;
@@ -225,7 +225,7 @@ namespace ZeroTier {
#endif #endif
#ifdef __DYNAMIC_LWIP__ // Use dynamically-loaded symbols (for use in normal desktop applications) #ifdef __DYNAMIC_STACK__ // Use dynamically-loaded symbols (for use in normal desktop applications)
if(_libref == NULL) if(_libref == NULL)
DEBUG_ERROR("dlerror(): %s", dlerror()); DEBUG_ERROR("dlerror(): %s", dlerror());