Fixing Android/Java crash on boot due to missing init method (#70)
* adding extern c to library methods to fix JNI crash on init * changed style to use ifdef cplusplus
This commit is contained in:
@@ -36,6 +36,8 @@ using namespace ZeroTier;
|
|||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace ZeroTier
|
namespace ZeroTier
|
||||||
{
|
{
|
||||||
extern NodeService *service;
|
extern NodeService *service;
|
||||||
@@ -153,6 +155,11 @@ int zts_start(const char *path, void (*callback)(void *), uint16_t port)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SDK_JNI
|
#ifdef SDK_JNI
|
||||||
JNIEXPORT jint JNICALL Java_com_zerotier_libzt_ZeroTier_start(
|
JNIEXPORT jint JNICALL Java_com_zerotier_libzt_ZeroTier_start(
|
||||||
JNIEnv *env, jobject thisObj, jstring path, jobject callback, jint port)
|
JNIEnv *env, jobject thisObj, jstring path, jobject callback, jint port)
|
||||||
@@ -379,6 +386,11 @@ JNIEXPORT jint JNICALL Java_com_zerotier_libzt_ZeroTier_join(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int zts_leave(const uint64_t nwid)
|
int zts_leave(const uint64_t nwid)
|
||||||
{
|
{
|
||||||
Mutex::Lock _l(serviceLock);
|
Mutex::Lock _l(serviceLock);
|
||||||
@@ -617,6 +629,9 @@ int zts_get_all_network_details(struct zts_network_details *nds, int *num)
|
|||||||
#ifdef SDK_JNI
|
#ifdef SDK_JNI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void zts_delay_ms(long interval_ms)
|
void zts_delay_ms(long interval_ms)
|
||||||
{
|
{
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__)
|
||||||
@@ -627,3 +642,7 @@ void zts_delay_ms(long interval_ms)
|
|||||||
nanosleep(&sleepValue, NULL);
|
nanosleep(&sleepValue, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user