Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

69
vendor/jni/example/HelloWorld.h vendored Normal file
View File

@@ -0,0 +1,69 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class HelloWorld */
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: HelloWorld
* Method: hello
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_HelloWorld_hello
(JNIEnv *, jclass, jstring);
/*
* Class: HelloWorld
* Method: helloByte
* Signature: ([B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_HelloWorld_helloByte
(JNIEnv *, jclass, jbyteArray);
/*
* Class: HelloWorld
* Method: factAndCallMeBack
* Signature: (ILHelloWorld;)V
*/
JNIEXPORT void JNICALL Java_HelloWorld_factAndCallMeBack
(JNIEnv *, jclass, jint, jobject);
/*
* Class: HelloWorld
* Method: counterNew
* Signature: (LHelloWorld;)J
*/
JNIEXPORT jlong JNICALL Java_HelloWorld_counterNew
(JNIEnv *, jclass, jobject);
/*
* Class: HelloWorld
* Method: counterIncrement
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_HelloWorld_counterIncrement
(JNIEnv *, jclass, jlong);
/*
* Class: HelloWorld
* Method: counterDestroy
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_HelloWorld_counterDestroy
(JNIEnv *, jclass, jlong);
/*
* Class: HelloWorld
* Method: asyncComputation
* Signature: (LHelloWorld;)V
*/
JNIEXPORT void JNICALL Java_HelloWorld_asyncComputation
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

49
vendor/jni/example/HelloWorld.java vendored Normal file
View File

@@ -0,0 +1,49 @@
class HelloWorld {
private static native String hello(String input);
private static native byte[] helloByte(byte[] input);
private static native void factAndCallMeBack(int n, HelloWorld callback);
private static native long counterNew(HelloWorld callback);
private static native void counterIncrement(long counter_ptr);
private static native void counterDestroy(long counter_ptr);
private static native void asyncComputation(HelloWorld callback);
static {
System.loadLibrary("mylib");
}
public static void main(String[] args) {
String output = HelloWorld.hello("josh");
System.out.println(output);
byte[] outputByte = HelloWorld.helloByte("byte".getBytes());
System.out.println(outputByte);
HelloWorld.factAndCallMeBack(6, new HelloWorld());
long counter_ptr = counterNew(new HelloWorld());
for (int i = 0; i < 5; i++) {
counterIncrement(counter_ptr);
}
counterDestroy(counter_ptr);
System.out.println("Invoking asyncComputation (thread id = " + Thread.currentThread().getId() + ")");
asyncComputation(new HelloWorld());
}
public void factCallback(int res) {
System.out.println("factCallback: res = " + res);
}
public void counterCallback(int count) {
System.out.println("counterCallback: count = " + count);
}
public void asyncCallback(int progress) {
System.out.println("asyncCallback: thread id = " + Thread.currentThread().getId() + ", progress = " + progress + "%");
}
}

10
vendor/jni/example/Makefile vendored Normal file
View File

@@ -0,0 +1,10 @@
java_run: lib
javac HelloWorld.java && java -Djava.library.path=mylib/target/debug/ HelloWorld
.PHONY: lib
javah:
javah HelloWorld
lib:
cd mylib && cargo build