diff --git a/Native/Source/Library.c b/Native/Source/Library.c index 11a4fd6..2f736b2 100644 --- a/Native/Source/Library.c +++ b/Native/Source/Library.c @@ -1,9 +1,10 @@ // Copyright (c) TribuFu. All Rights Reserved -#include "Library.h" +#include #include "TribuFu.h" +#include "Library.h" -char *Java_Hello(char *input) +JNIEXPORT jstring JNICALL Java_tribufu_TribuFu_Hello(JNIEnv *, jobject, jstring) { char *result = Hello("C"); diff --git a/Native/Source/Library.h b/Native/Source/Library.h index 12443ae..6f47672 100644 --- a/Native/Source/Library.h +++ b/Native/Source/Library.h @@ -2,18 +2,12 @@ #pragma once +#include #include "TribuFu.h" -#if defined(_MSC_VER) - #define EXPORT __declspec(dllexport) - #define IMPORT __declspec(dllimport) -#elif defined(__GNUC__) - #define EXPORT __attribute__((visibility("default"))) - #define IMPORT -#else - #define EXPORT - #define IMPORT - #pragma warning Unknown dynamic link import/export semantics. -#endif - -EXPORT char *Java_Hello(char *input); +/* + * Class: tribufu_TribuFu + * Method: Hello + * Signature: (Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_tribufu_TribuFu_Hello(JNIEnv *, jobject, jstring); diff --git a/Source/TribuFu.java b/Native/Source/TribuFu.java similarity index 80% rename from Source/TribuFu.java rename to Native/Source/TribuFu.java index 813884f..add043f 100644 --- a/Source/TribuFu.java +++ b/Native/Source/TribuFu.java @@ -9,7 +9,7 @@ public class TribuFu { public native String Hello(String input); // Used to load the 'TribuFu' library on application startup. - public void LoadLibrary() { - System.loadLibrary("TribuFu"); + static { + System.loadLibrary("TribuFu_jvm"); } } diff --git a/Source/Library.c b/Source/Library.c deleted file mode 100644 index 2f736b2..0000000 --- a/Source/Library.c +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) TribuFu. All Rights Reserved - -#include -#include "TribuFu.h" -#include "Library.h" - -JNIEXPORT jstring JNICALL Java_tribufu_TribuFu_Hello(JNIEnv *, jobject, jstring) -{ - char *result = Hello("C"); - - return result; -} diff --git a/Source/Library.h b/Source/Library.h deleted file mode 100644 index 6f47672..0000000 --- a/Source/Library.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) TribuFu. All Rights Reserved - -#pragma once - -#include -#include "TribuFu.h" - -/* - * Class: tribufu_TribuFu - * Method: Hello - * Signature: (Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_tribufu_TribuFu_Hello(JNIEnv *, jobject, jstring);