How do i call C/C++ code from Android using JNA? -
i'm trying integrate specific library android project, , library written in c/c++. i've miraculously gotten ndk-build
give me needed .so
file.
however, looking @ it, there's sample in project, , use mysterious .jar
api bindings of .c
/c++
files.
how either
- create special
.jar
file has api, based on.so
?
or
- directly add method main
c++
file , call java?
i've tried re-wrap things using jni, doesn't seem work. keep getting unsatisfiedlinkerror
.
a lot of documentation online uses jni tutorial. i'm happy few links tutorials on jna.
jna provides stub native library, libjnidispatch.so
variety of platforms. can build library yourself, or extract 1 of pre-built binaries project's lib/native/<platform>.jar
packages.
you include libjnidispatch.so
in android project way other jni library. required; cannot rely on jna dynamically unpack , use native library automatically on other platforms. jna project includes details doing so (as instructions building libjnidispatch.so
yourself).
you use jna.jar
other java jar file, , write own (java) mappings match native library you're trying access. there's jna-min.jar
omits native platform libraries bundled in jna.jar
.
Comments
Post a Comment