summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/sun/gluegen/JavaMethodBindingEmitter.java')
-rw-r--r--src/java/com/sun/gluegen/JavaMethodBindingEmitter.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
index b5b5b9c..4153e32 100644
--- a/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
+++ b/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java
@@ -730,11 +730,17 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
if (!returnType.isNIOByteBuffer()) {
// See whether we have to expand pointers to longs
if (getBinding().getCReturnType().pointerDepth() >= 2) {
- if (!returnType.isNIOPointerBuffer()) {
+ if (returnType.isNIOPointerBuffer()) {
+ writer.println(" return PointerBuffer.wrap(_res);");
+ } else if (returnType.isNIOInt64Buffer()) {
+ writer.println(" return Int64Buffer.wrap(_res);");
+ } else {
throw new RuntimeException("While emitting glue code for " + getName() +
- ": can not legally make pointers opaque to anything but longs");
+ ": can not legally make pointers opaque to anything but PointerBuffer or Int64Buffer/long");
}
- writer.println(" return PointerBuffer.wrap(_res);");
+ } else if (getBinding().getCReturnType().pointerDepth() == 1 &&
+ returnType.isNIOInt64Buffer()) {
+ writer.println(" return Int64Buffer.wrap(_res);");
} else {
String returnTypeName = returnType.getName().substring("java.nio.".length());
writer.println(" return _res.as" + returnTypeName + "();");