【发布时间】:2013-03-05 06:41:59
【问题描述】:
我正在使用 C# 调用 DLL 函数。
[DllImport("MyDLL.dll", SetLastError = true)]
public static extern uint GetValue(
pHandle handle,
ref somestruct a,
ref somestruct b);
如何为参数 3 传递 null 引用?
当我尝试时,我得到一个编译时错误:
无法从
<null>转换为 ref somestruct。
我也试过IntPtr.Zero。
【问题讨论】:
-
是
ref参数?那么为什么不向我们展示确切的方法签名呢?somestruct真的是结构体还是类? -
修复它。它是一个结构
标签: c# null interop parameter-passing value-type