summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/JavaEmitter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/gluegen/JavaEmitter.java')
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 917ff35..0a403ea 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -844,7 +844,7 @@ public class JavaEmitter implements GlueEmitter {
// Note that machDescJava MachineDataInfo is always 64bit unix,
// which complies w/ Java types.
- boolean needsNativeCode = false;
+ boolean needsNativeCode = !cfg.customJNICodeForClass(containingJTypeName).isEmpty();
// Native code for calls through function pointers gets emitted
// into the abstract base class; Java code which accesses fields
@@ -1176,6 +1176,7 @@ public class JavaEmitter implements GlueEmitter {
javaUnit.emitln("}");
javaUnit.close();
if (needsNativeCode) {
+ emitCustomJNICode(jniUnit, containingJTypeName);
jniUnit.close();
}
if( GlueGen.debug() ) {
@@ -2721,6 +2722,23 @@ public class JavaEmitter implements GlueEmitter {
unit.emitln(" // ---- End CustomJavaCode .cfg declarations");
}
+ /**
+ * Emit all the strings specified in the "CustomJNICode" parameters of
+ * the configuration file.
+ */
+ protected void emitCustomJNICode(final CodeUnit unit, final String className) throws Exception {
+ final List<String> code = cfg.customJNICodeForClass(className);
+ if (code.isEmpty())
+ return;
+
+ unit.emitln();
+ unit.emitln(" // --- Begin CustomJNICode .cfg declarations");
+ for (final String line : code) {
+ unit.emitln(line);
+ }
+ unit.emitln(" // ---- End CustomJNICode .cfg declarations");
+ }
+
public String[] getClassAccessModifiers(final String classFQName) {
String[] accessModifiers;
final MethodAccess acc = cfg.accessControl(classFQName);