diff --git a/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java b/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java index fa1db216..48dcf42f 100644 --- a/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java +++ b/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java @@ -215,7 +215,8 @@ public class NativeMethodStubsGenerator { } else { Class java_type = Utils.getJavaType(param.getType()); if (Buffer.class.isAssignableFrom(java_type)) { - boolean explicitly_byte_sized = java_type.equals(Buffer.class); + boolean explicitly_byte_sized = java_type.equals(Buffer.class) || + translator.getAnnotationType().equals(type_map.getVoidType()); if (explicitly_byte_sized) writer.print("(((char *)"); if (method.getAnnotation(GenerateAutos.class) != null || (check_annotation != null && check_annotation.canBeNull())) { diff --git a/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java b/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java index 943c5c10..b0b9a56d 100644 --- a/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java +++ b/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java @@ -77,16 +77,20 @@ public class NativeTypeTranslator implements TypeVisitor { StringBuilder signature = new StringBuilder(); if (declaration.getAnnotation(Const.class) != null) signature.append("const "); - if (native_types.size() != 1) - throw new RuntimeException("Expected only one native type for declaration " + declaration + - ", but got " + native_types.size()); // Use the name of the native type annotation as the C type name - signature.append(native_types.iterator().next().getSimpleName()); + signature.append(getAnnotationType().getSimpleName()); if (is_indirect) signature.append(" *"); return signature.toString(); } + public Class getAnnotationType() { + if (native_types.size() != 1) + throw new RuntimeException("Expected only one native type for declaration " + declaration + + ", but got " + native_types.size()); + return native_types.iterator().next(); + } + public void visitAnnotationType(AnnotationType t) { throw new RuntimeException(t + " is not allowed"); }