-
-
Notifications
You must be signed in to change notification settings - Fork 591
Closed
Labels
Description
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:
JNIEXPORT jint JNICALL Java_org_helixd2s_yavulkanmod_wrapper_Alter_00024BucketOfDescriptorImageInfo_add(JNIEnv* env, jobject obj, jlong arg0) {
::cpp21::bucket<vk::DescriptorImageInfo>* ptr = (::cpp21::bucket<vk::DescriptorImageInfo>*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
if (ptr == NULL) {
env->ThrowNew(JavaCPP_getClass(env, 9), "This pointer address is NULL.");
return 0;
}
jlong position = env->GetLongField(obj, JavaCPP_positionFID);
ptr += position;
jint rarg = 0;
jthrowable exc = NULL;
try {
int rval = ptr->add((vk::DescriptorImageInfo*)arg0);
rarg = (jint)rval;
} catch (...) {
exc = JavaCPP_handleException(env, 8);
}
if (exc != NULL) {
env->Throw(exc);
}
return rarg;
}
Compiler error:
Severity Code Description Project File Line Suppression State
Error C2664 'uintptr_t cpp21::bucket_<vk::DescriptorImageInfo,std::vector,cpp21::shared_vector>::add(const T &)': cannot convert argument 1 from 'vk::DescriptorImageInfo *' to 'const T &' YAV C:\VULKAN\YetAnotherVulkanMod\src\main\cpp\jniAlter.cpp 1582
Should to be line: int rval = ptr->add(*(vk::DescriptorImageInfo*)arg0);