From 2fae63d78c18085eef5324853a3d30f1d33f8d83 Mon Sep 17 00:00:00 2001 From: Juan Fumero Date: Tue, 28 May 2024 12:40:01 +0200 Subject: [PATCH] [hotfix] Windows build fixed --- .../src/main/cpp/source/SPIRVOCLDispatcher.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tornado-drivers/opencl-jni/src/main/cpp/source/SPIRVOCLDispatcher.cpp b/tornado-drivers/opencl-jni/src/main/cpp/source/SPIRVOCLDispatcher.cpp index 538758bb68..3c0342788c 100644 --- a/tornado-drivers/opencl-jni/src/main/cpp/source/SPIRVOCLDispatcher.cpp +++ b/tornado-drivers/opencl-jni/src/main/cpp/source/SPIRVOCLDispatcher.cpp @@ -48,12 +48,12 @@ JNIEXPORT jlong JNICALL Java_uk_ac_manchester_tornado_drivers_spirv_ocl_SPIRVOCL #else cl_context context = reinterpret_cast(contextPointer); jbyte* spirv = env->GetByteArrayElements(spirvBinary, 0); - long* length = env->GetLongArrayElements(spirvArrayLength, 0); + jlong* length = env->GetLongArrayElements(spirvArrayLength, 0); cl_int status; cl_program programPointer = clCreateProgramWithIL(context, spirv , length[0], &status); LOG_OCL_AND_VALIDATE("clCreateProgramWithIL", status); - int statusArray[1]; + jint* statusArray = static_cast(malloc(sizeof(jint))); statusArray[0] = status; env->SetIntArrayRegion(errorCodeArray, 0, 1, statusArray); @@ -90,7 +90,7 @@ JNIEXPORT jlong JNICALL Java_uk_ac_manchester_tornado_drivers_spirv_ocl_SPIRVOCL const char *kernelNameC = env->GetStringUTFChars(kernelName, NULL); cl_int status; cl_kernel kernel = clCreateKernel((cl_program) programPointer,kernelNameC, &status); - int statusArray[1]; + jint* statusArray = static_cast(malloc(sizeof(jint))); statusArray[0] = status; env->SetIntArrayRegion(errorCode, 0, 1, statusArray); env->ReleaseStringUTFChars(kernelName, kernelNameC); @@ -164,8 +164,8 @@ JNIEXPORT jint JNICALL Java_uk_ac_manchester_tornado_drivers_spirv_ocl_SPIRVOCLN } if (kernelEventArray != nullptr) { - long kernelEventNative[1]; - kernelEventNative[0] = reinterpret_cast(kernelEvent); + jlong* kernelEventNative = static_cast(malloc(sizeof(jlong))); + kernelEventNative[0] = reinterpret_cast(kernelEvent); env->SetLongArrayRegion(kernelEventArray, 0, 1, kernelEventNative); } return status;