Hello Martin.

The combat was hard but I win the war ;)

It works, Pascal code + fpc = Android native library that works.

For the people that are interested here how to do:

1) Use the Java arguments for all your exported methods like this (2 first
parameters):

procedure MyAndroidProc(PEnv: PJNIEnv; Obj: JObject); cdecl;       
begin
// do something
end;

2) Export your method using that name (maybe it is possible to change this
in Java calling class but that way it works):

 MyAndroidProc name 'Java_nameoftheJavaApplication_MyAndroidProc';

3) Compile your library with -Parm (for 32 bit) and -Tandroid parameters.

4) In your Android Studio project, create 2 directories and add your library
into it : 
- nameoftheJavaApplication/app/src/main/jniLibs/armeabi and 
- nameoftheJavaApplication/app/src/main/jniLibs/armeabi-v7a

5) In Java code android, add this code to force Android to compile only 32
bit application (fpc + android64 is not yet ready)

android {
    ....
    defaultConfig {
        ....
        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
        }
    }
}

6) Create a Java class with all the exported method of your library
(header).

7) In your main Java class, load the library with LoadLibrary().

8) Compile your apk application, transfer it to your Android mobile (with
Android Studio).

9) Enjoy.


Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to