An unhandled exception of type 'System.AccessViolationException' occurred in OpenCLNet.dll

463 views Asked by At

An unhandled exception of type 'System.AccessViolationException' occurred in OpenCLNet.dll

@

Platform test = new Platform(platformid); and "platformID" has a value of 1 in runtime.

public class Program
{
    static void Main(string[] args)
    {
        IntPtr[] IntPtrArr = new IntPtr[10];
        uint platformID;
        OpenCL.GetPlatformIDs(1, IntPtrArr,out platformID);
        IntPtr platformid = new IntPtr(platformID);
        Platform test = new Platform(platformid);
    }
}

Am I even getting the PlatfromID or the platfromid correctly?

1

There are 1 answers

0
jacob On BEST ANSWER

The OpenCL.GetPlatformIDs out parameter is not a platform ID, it is the amount of platforms that are set in your IntPtrArr, check to see the entries in IntPtrArr have been set, and if so use them as your platformID.