mirror of
https://github.com/tribufu/tribufu-java
synced 2026-06-01 09:42:37 +00:00
Update JNI Bindings
This commit is contained in:
parent
0d148a829f
commit
e24715c22a
5 changed files with 12 additions and 42 deletions
|
|
@ -1,9 +1,10 @@
|
||||||
// Copyright (c) TribuFu. All Rights Reserved
|
// Copyright (c) TribuFu. All Rights Reserved
|
||||||
|
|
||||||
#include "Library.h"
|
#include <jni.h>
|
||||||
#include "TribuFu.h"
|
#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");
|
char *result = Hello("C");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
#include "TribuFu.h"
|
#include "TribuFu.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
/*
|
||||||
#define EXPORT __declspec(dllexport)
|
* Class: tribufu_TribuFu
|
||||||
#define IMPORT __declspec(dllimport)
|
* Method: Hello
|
||||||
#elif defined(__GNUC__)
|
* Signature: (Ljava/lang/String;)Ljava/lang/String;
|
||||||
#define EXPORT __attribute__((visibility("default")))
|
*/
|
||||||
#define IMPORT
|
JNIEXPORT jstring JNICALL Java_tribufu_TribuFu_Hello(JNIEnv *, jobject, jstring);
|
||||||
#else
|
|
||||||
#define EXPORT
|
|
||||||
#define IMPORT
|
|
||||||
#pragma warning Unknown dynamic link import/export semantics.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPORT char *Java_Hello(char *input);
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ public class TribuFu {
|
||||||
public native String Hello(String input);
|
public native String Hello(String input);
|
||||||
|
|
||||||
// Used to load the 'TribuFu' library on application startup.
|
// Used to load the 'TribuFu' library on application startup.
|
||||||
public void LoadLibrary() {
|
static {
|
||||||
System.loadLibrary("TribuFu");
|
System.loadLibrary("TribuFu_jvm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
// Copyright (c) TribuFu. All Rights Reserved
|
|
||||||
|
|
||||||
#include <jni.h>
|
|
||||||
#include "TribuFu.h"
|
|
||||||
#include "Library.h"
|
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_tribufu_TribuFu_Hello(JNIEnv *, jobject, jstring)
|
|
||||||
{
|
|
||||||
char *result = Hello("C");
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright (c) TribuFu. All Rights Reserved
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <jni.h>
|
|
||||||
#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);
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue