I know that it is possible to generate the JNI given a Java implementation using javac
but is there a way to do the opposite (a "cjava
")?
So if I have something like this:
mypackage/mylib.h
:
void helloWorld();
mypackage/mylib.c
:
#include <iostream>
void helloWorld() {
std::cout << "Hello World!" << std::endl;
}
Shouldn't it be possible to generate the JNI like
mylib-jni.c
:
#include "mypackage/mylib."
JNIEXPORT jlong JNICALL Java_mypackage_helloWorld() {
helloWorld();
}
and
Mylib.java
:
package mypackage;
public class Mylib {
public native void helloWorld();
}
etc.
Somehow I am not stumbling upon something like that.