public class Tester {
// Load Library
static { System.loadLibrary("tester"); }
public native int pTest (int value);
}
And here is some sample Object Pascal code from the project that shows how to create a function and export it from the Delphi XE7 Object Pascal shared object file:
Function pTest (env: PJNIEnv; this: jobject; value : integer): integer; cdecl;
begin
Dbg( MarshaledAString( 'pTest >> In:' +IntToStr(Value) + 'Out:' + IntToStr(Value+100)));
Result := Value + Inx;
Inc(Inx);
end;
exports
JNI_OnLoad name 'JNI_OnLoad',
JNI_OnUnload name 'JNI_OnUnload',
calc name 'calc',
pTest name cFuncPrefix+'pTest';
And lastly here is some pieces of code from the example which show how to load the above Java class and Android NDK shared object and call the Delphi XE7 function in Java:
public Tester tester;
tester = new Tester();
int rst = tester.pTest(123);
The instructions are a little bit unclear because it talks about a build batch file but I don’t see that anywhere. I assume you just build the Delphi XE7 project and then compile and pack your two Java classes as an Android SDK with the shared object file from XE7 in the appropriate directory. This project should probably also compile in Appmethod.
There is also a second page which more extensive instructions which is linked from the first but I’m not sure how it applies to the first project other than it tells how to setup building for the Android SDK.
Lastly here are the three source files for the bare bones Delphi XE7 Android shared object and app.