I have the Java code below:
public class JavaToC {
protected void hereIsYourCallback(long l, double d, boolean b, Object obj) {
// this should be implemented by subclasses
}
public void start() {
try {
while(true) {
Thread.sleep(5000);
hereIsYourCallback(3L, Math.PI, true, "Hello from Java!");
}
} catch(InterruptedException e) {
// NOOP
} catch(Exception e) {
e.printStackTrace();
}
}
}
Is it possible to write a C++ code that would somehow trap every JVM call to hereIsYourCallback
? Note that this callback would have to come from an embedded JVM instantiated through JNI_CreateJavaVM
.