diff options
author | Sven Gothel <[email protected]> | 2023-06-29 02:18:18 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-06-29 02:18:18 +0200 |
commit | ce542531f4cb6fe2bf37f3926ea869722e5acf7d (patch) | |
tree | 12743ccbf43fec5a5d8da2a5abba1e5831cc80cd /src/java/com/jogamp/gluegen/JavaEmitter.java | |
parent | 9f69f8b60b9fdc80076e20f303252ddd35b97ccf (diff) |
GlueGen LibraryOnLoad Config: Generate `JNI_OnLoad(..)` for dynamic and `JNI_OnLoad_<LibraryBasename>(..)` for static libraries and `JVMUtil_GetJNIEnv(..)` to resolve the `JNIEnv*` as used by JavaCallback
Diffstat (limited to 'src/java/com/jogamp/gluegen/JavaEmitter.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 3a86239..939ce92 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -2980,7 +2980,10 @@ public class JavaEmitter implements GlueEmitter { } if (cfg.emitImpl()) { - cUnit().emitHeader(getImplPackageName(), cfg.implClassName(), cfg.customCCode()); + if( !cfg.getJavaCallbackList().isEmpty() && null == cfg.libraryOnLoadName() ) { + LOG.log(WARNING, "JavaCallback used, but no 'LibraryOnLoad' basename specified for JNI_OnLoad(..). Exactly one native code-unit for the library must specify with 'LibraryOnLoad' basename"); + } + cUnit().emitHeader(cfg.libraryOnLoadName(), getImplPackageName(), cfg.implClassName(), cfg.customCCode()); } } catch (final Exception e) { throw new RuntimeException( @@ -3004,6 +3007,9 @@ public class JavaEmitter implements GlueEmitter { javaImplUnit.emitTailCode(); javaImplUnit().emitln("} // end of class " + cfg.implClassName()); } + if (cfg.emitImpl() && null != cfg.libraryOnLoadName() ) { + cUnit.emitJNIOnLoadJNIEnvCode(cfg.libraryOnLoadName()); + } } private JavaType javaType(final Class<?> c) { |