diff options
-rw-r--r-- | make/build-test.xml | 2 | ||||
-rw-r--r-- | src/java/com/jogamp/gluegen/CMethodBindingEmitter.java | 8 | ||||
-rw-r--r-- | src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java | 7 |
3 files changed, 14 insertions, 3 deletions
diff --git a/make/build-test.xml b/make/build-test.xml index b270ccd..624bd61 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -148,7 +148,7 @@ debug="${javacdebug}" debuglevel="${javacdebuglevel}"> <classpath refid="junit.compile.classpath"/> <compilerarg value="-proc:only"/> - <compilerarg value="-J-Djogamp.gluegen.structgen.debug"/> + <!-- compilerarg value="-J-Djogamp.gluegen.structgen.debug"/ --> <compilerarg value="-J-Djogamp.gluegen.structgen.output=${build_t.gen}/classes"/> <src path="${test.base.dir}/com/jogamp/gluegen/test/junit/structgen"/> <src path="${build_t.gen}/classes/com/jogamp/gluegen/test/junit/structgen" /> diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java index 16adbe9..1987668 100644 --- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java @@ -459,6 +459,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { writer.print(" "); // Note we respect const/volatile in the function return type. // However, we cannot have it 'const' for our local variable. + // See cast in emitBodyCallCFunction(..)! writer.print(binding.getCSymbol().getReturnType().getCName(false)); writer.println(" _res;"); if (javaReturnType.isNIOByteBufferArray() || @@ -978,7 +979,12 @@ public class CMethodBindingEmitter extends FunctionEmitter { final Type cReturnType = binding.getCReturnType(); if (!cReturnType.isVoid()) { - writer.print("_res = "); + // Note we respect const/volatile in the function return type. + // However, we cannot have it 'const' for our local variable. + // See return type in emitBodyVariableDeclarations(..)! + writer.print("_res = ("); + writer.print(cReturnType.getCName(false)); + writer.print(") "); } if ( isCStructFunctionPointer && binding.hasContainingType() ) { // Call through function pointer diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java index 4707e57..57a50cc 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java @@ -198,7 +198,12 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { final Type cReturnType = binding.getCReturnType(); if (!cReturnType.isVoid()) { - writer.print("_res = "); + // Note we respect const/volatile in the function return type. + // However, we cannot have it 'const' for our local variable. + // See return type in CMethodBindingEmitter.emitBodyVariableDeclarations(..)! + writer.print("_res = ("); + writer.print(cReturnType.getCName(false)); + writer.print(") "); } final MethodBinding mBinding = getBinding(); if (mBinding.hasContainingType()) { |