Files
upm/src/lol/javaupm_lol.i
Stefan Andritoiu dddba3e8a4 java: Added auto load library code in upm SWIG interfaces
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2015-11-24 14:36:17 -08:00

36 lines
811 B
OpenEdge ABL

%module javaupm_lol
%include "../upm.i"
%include "stdint.i"
%include "arrays_java.i";
%include "typemaps.i"
%typemap(jni) unsigned char* "jbyteArray";
%typemap(jtype) unsigned char* "byte[]";
%typemap(jstype) unsigned char* "byte[]";
%typemap(javaout) unsigned char* {
return $jnicall;
}
%typemap(out) unsigned char* {
$result = JCALL1(NewByteArray, jenv, LOL_X*LOL_Y);
JCALL4(SetByteArrayRegion, jenv, $result, 0, LOL_X*LOL_Y-1, reinterpret_cast<jbyte*>($1));
delete [] $1;
}
%{
#include "lol.h"
%}
%include "lol.h"
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("javaupm_lol");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}