-
Notifications
You must be signed in to change notification settings - Fork 586
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
Casting to pointer isn't passing by reference #576
Comments
I've fixed that in commit 23664f6. Please give it a try with the snapshots: http://bytedeco.org/builds/ |
I have similar issue, but for getters. Needs reversal. I copy content from that issue: I expected line such as @Name("extent")
@MemberGetter @Cast("uintptr_t") @ByRef public native long getExtent(); But getting wrong code: JNIEXPORT jlong JNICALL Java_org_helixd2s_yavulkanmod_alter_header_CreateInfo_00024ImageCreateInfo_getExtent(JNIEnv* env, jobject obj) {
::alter::ImageCreateInfo* ptr = (::alter::ImageCreateInfo*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
if (ptr == NULL) {
env->ThrowNew(JavaCPP_getClass(env, 7), "This pointer address is NULL.");
return 0;
}
jlong position = env->GetLongField(obj, JavaCPP_positionFID);
ptr += position;
jlong rarg = 0;
jthrowable exc = NULL;
try {
uintptr_t rval = (uintptr_t)ptr->extent;
rarg = (jlong)rval;
} catch (...) {
exc = JavaCPP_handleException(env, 9);
}
if (exc != NULL) {
env->Throw(exc);
}
return rarg;
} |
Sure thing, done in commit 307eb90. Enjoy! |
Something go wrong: |
|
The |
Fixes for this issue have been released with JavaCPP 1.5.8. Thanks for reporting and for testing! |
I would like to let the address from LWJGL into JavaCpp of the long type.
What we doing:
public native int add(@ByRef @Cast("vk::DescriptorImageInfo*") long ptr);
Result CPP code:
Compiler error:
Should to be line:
int rval = ptr->add(*(vk::DescriptorImageInfo*)arg0);
The text was updated successfully, but these errors were encountered: