未处理的类型' System.AccessViolationException'发生在OpenCLNet.dll中

时间:2016-01-19 03:29:19

标签: c# opencl.net

未处理的类型' System.AccessViolationException'发生在OpenCLNet.dll

@

平台测试=新平台(platformid); 和" platformID"在运行时具有值1。

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);
    }
}

我是否正确地获得了PlatfromID或platfromid?

1 个答案:

答案 0 :(得分:2)

OpenCL.GetPlatformIDs输出参数不是平台ID,而是IntPtrArr中设置的平台数量,请检查IntPtrArr中的条目是否已设置,以及如果是这样,请将它们用作platformID