Added the JAVA_JNI_LOADLIBRARY macro for the jniclasscode pragma included in _upm.i for all java SWIG interface files.

This commit is contained in:
Serban Waltter
2018-01-17 14:11:35 +02:00
committed by Noel Eck
parent 6725559669
commit 2551596309
220 changed files with 228 additions and 2193 deletions

View File

@ -1,9 +1,8 @@
/* Macro for adding JAVA runnables.
example usage: JAVA_ADD_INSTALLISR(upm::A110x)
UPMClassName - UPM class name w/namespace.
/* Macro for adding JAVA run
usage: JAVA_ADD_INSTALLISR(javaupm_a110x)
*/
%define JAVA_ADD_INSTALLISR(UPMClassName)
%extend UPMClassName {
%define JAVA_ADD_INSTALLISR(UPM_Classname)
%extend UPM_Classname {
void installISR(jobject runnable)
{
$self->installISR(mraa_java_isr_callback, runnable);
@ -11,17 +10,16 @@
}
%enddef
/* Macro for adding JNI loadLibrary dependency.
example usage: JAVA_JNI_LOADLIBRARY(javaupm_rhusb)
PackageName: Target UPM JAVA package.
/* Macro for adding JNI loadLibrary dependency
usage: JAVA_JNI_LOADLIBRARY(javaupm_rhusb)
*/
%define JAVA_JNI_LOADLIBRARY(PackageName)
%define JAVA_JNI_LOADLIBRARY(MyModuleName)
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("PackageName");
System.loadLibrary("MyModuleName");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library (PackageName) failed to load. \n" + e);
System.err.println("Native code library (MyModuleName) failed to load. \n" + e);
System.exit(1);
}
}