-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong function pointer definition #162
Comments
How did you generate that? When I try this typedef: typedef const char* (*GetClipboardTextFn)(); The output is as follows and compiles fine: public static class GetClipboardTextFn extends FunctionPointer {
static { Loader.load(); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public GetClipboardTextFn(Pointer p) { super(p); }
protected GetClipboardTextFn() { allocate(); }
private native void allocate();
public native @Cast("const char*") BytePointer call();
} |
I've checked the code, and This comes from here: https://github.com/ocornut/imgui/blob/master/imgui.h#L761 I've also discovered my workaround is not perfect. The getter/setter for the function pointer will not be created... |
Still doesn't happen here. I get this: public static class GetClipboardTextFn_Pointer extends FunctionPointer {
static { Loader.load(); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public GetClipboardTextFn_Pointer(Pointer p) { super(p); }
protected GetClipboardTextFn_Pointer() { allocate(); }
private native void allocate();
public native @Cast("const char*") BytePointer call(Pointer user_data);
}
@MemberGetter public native GetClipboardTextFn_Pointer GetClipboardTextFn(); |
Ok, my original report seems wrong. What I'm really getting in Java is: public static class @Cast("const char*") BytePointer_GetClipboardTextFn extends FunctionPointer {
static { Loader.load(); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public @Cast("const char*") BytePointer_GetClipboardTextFn(Pointer p) { super(p); }
protected @Cast("const char*") BytePointer_GetClipboardTextFn() { allocate(); }
private native void allocate();
public native @Cast("const char*") BytePointer call();
}
@MemberGetter public native @Cast("const char*") BytePointer_GetClipboardTextFn GetClipboardTextFn(); ... so |
https://expirebox.com/download/efce5caa04c94eb8c9c481b7a1016a56.html contains the bindings, hopefully you should be able to just do "mvn clean package" and the error will show. |
Ah, wait a minute, I had tried the one with the |
I've fixed this in the commit above. Thanks for reporting! |
And now part of JavaCPP as of version 1.3.2. Thanks again for the feedback! |
The following C++ definition:
...creates the following Java definition:
Both the
@Cast
on the class and the ones on the constructors make this impossible to compile.I've fixed this in my
InfoMap
in the meantime by doinginfoMap.put(new Info("char* (*)()").pointerTypes("GetClipboardTextFn"))
, which might also be a bug? (There is no way of referencing this that I can see other thanchar* (*)()
, but that can obviously match with multiple functions)The text was updated successfully, but these errors were encountered: