nikolaymetchev
12/30/2019, 6:07 PM#include<stdio.h>
#include<CL/cl.h>
int main(void)
{
cl_int err;
cl_uint numPlatforms;
err = clGetPlatformIDs(0, NULL, &numPlatforms);
if (CL_SUCCESS == err)
printf("\nDetected OpenCL platforms: %d", numPlatforms);
else
printf("\nError calling clGetPlatformIDs. Error code: %d", err);
return 0;
}
Here is what I thought the kotlin equivalent will be:
fun main() {
val numOfPlatforms: cl_uint = 0U
val result = clGetPlatformIDs(0, null, cValuesOf(numOfPlatforms))
if (CL_SUCCESS == result) {
println("Detected OpenCL platforms: ${numOfPlatforms}")
} else {
println("Error calling clGetPlatformIDs. Error code: $result");
}
}
However it seems that I am not passing the pointer to numOfPlatforms correctly as my program returns 0 instead of the expected value of 2. How do I pass a pointer to a an int using Kotlin native?Lei Wu
01/02/2020, 3:15 AM