Native C callback (beware : don't let your callbacks be GC'd before they're
used).
To protect a callback against the GC, you can keep a reference to your
callback or use
BridJ.protectFromGC(org.bridj.NativeObject)
/
BridJ.unprotectFromGC(org.bridj.NativeObject)
.
A callback is a Java object with only one abstract method exposed as a C
function pointer to the native world.
Here's an example of callback definition (use JNAerator to generate them
automatically) :
// typedef int (*MyCallback)(int a, int b);
public static abstract class MyCallback extends Callback {
public abstract int doSomething(int a, int b);
}