Skip to content

Instantly share code, notes, and snippets.

@ashumeow
Created February 4, 2014 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashumeow/8801467 to your computer and use it in GitHub Desktop.
Save ashumeow/8801467 to your computer and use it in GitHub Desktop.
class Callbacks {
private native void nativeMethod(int depth);
private void callback(int depth) //funtion NAME (parameter 1, 2, ....)
{
// statements
if (depth < 5)
{
//calling the function
System.out.println("In Java, depth = " + depth + ", about to enter C");
nativeMethod(depth + 1);
System.out.println("In Java, depth = " + depth + ", back from C");
} else
System.out.println("In Java, depth = " + depth + ", limit exceeded");
}
public static void main(String args[])
{
Callbacks c = new Callbacks();
c.nativeMethod(0);
}
static
{
System.loadLibrary("MyImpOfCallbacks");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment