[英]C# passing double array to C++ dll
I have an array initialized in C# code; 我有一个用C#代码初始化的数组; Then I am going to pass it to C++ dll in which each single entry of the array will be re-assigned with new value. 然后我将它传递给C ++ dll,其中将使用新值重新分配数组的每个单个条目。 Then the array with be returned back to C# with the new value. 然后使用新值将数组返回给C#。 I am wondering 我想知道
My code is not working: 我的代码不起作用:
In C# 在C#中
private static double[] _statsArray = new double[4];
GetImageStats( ref _statsArray);
In C++ dll: 在C ++ DLL中:
DllExportImageStatistics GetImageStats( double (&pSignalArray)[4])
Thanks for any suggestions; 谢谢你的任何建议; A couple of lines of code will help a lot. 几行代码将有很多帮助。
I think it should be: 我认为它应该是:
private static double[] _statsArray = new double[4];
GetImageStats(_statsArray); // Lose the ref
And 和
DllExportImageStatistics GetImageStats(double pSignalArray[4])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.