diff options
author | Sven Gothel <[email protected]> | 2023-06-26 03:14:59 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-06-26 03:14:59 +0200 |
commit | 93c63bd880b6bc8a85a0057112b5065b312af1db (patch) | |
tree | 6633d4ecddecc5f361f0443eebae559055af84a0 /src/java/com/jogamp/gluegen | |
parent | 90b86c62270c494d2422dabc2879e59e063b535c (diff) |
GlueGen JavaCallback: Use new JavaType nature 'named-class', denoting the generated callback interface mapping the callback function.
This passes the jobject for the callback function/interface and the userParam (from 'void*')
down to the native implementation.
TODO: Add specific native implementation for JavaCallback,
wrapping the jobject's into a native struct as user-param
and a universal C-function as the native callback to dispatch
the call to the java method with known arguments.
Diffstat (limited to 'src/java/com/jogamp/gluegen')
-rw-r--r-- | src/java/com/jogamp/gluegen/CMethodBindingEmitter.java | 4 | ||||
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java index be69a38..334df1b 100644 --- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java @@ -1212,6 +1212,10 @@ public class CMethodBindingEmitter extends FunctionEmitter { if (type.isPrimitiveArray()) { getJNIMangledArg(Integer.TYPE, buf, false); } + } else if (type.isNamedClass()) { + buf.append("L"); + buf.append(type.getName().replace('.', '_')); + buf.append("_2"); } else if (type.isCompoundTypeWrapper()) { // Mangle wrappers for C structs as ByteBuffer getJNIMangledArg(java.nio.ByteBuffer.class, buf, true); diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 59ca290..4953807 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -3103,7 +3103,7 @@ public class JavaEmitter implements GlueEmitter { if( isJavaCallbackArg ) { // Replace JavaCallback type with generated interface name - mappedType = JavaType.createForCStruct(cArgType.getName()); + mappedType = JavaType.createForNamedClass(cArgType.getName()); } else if( null != javaCallback && null != javaCallback.userParamName && javaCallback.userParamName.equals( cArgName ) && cArgType.isPointer() && cArgType.getTargetType().isVoid() ) |