使用DllImport时,在C#中包装C ++参考参数
||
我正在尝试使用C#代码包装具有参考参数的C ++函数。
我的C#包装器类有
[DllImport(TestCppDLL.dll)]
public static extern void foo(out int a, out int b, out double c);
public void main()
{
int a;
int b;
double c;
this.foo(out a, out b, out c);
Console.WriteLine(a + b + c);
}
我的C ++代码是
extern void foo(int &a, int &b, double &c)
{
a = 1;
b = 2;
c = 3;
}
因此,我希望输出为\“ 123 \”,但得到\“ 000 \”。
如何包装C ++参考参数?
先感谢您,
没有找到相关结果
已邀请:
1 个回复
傻零凰死授