我想从非托管C++传递大约100 - 10,000点到C#.
C++端看起来像这样:
__declspec(dllexport) void detect_targets( char * , int , /* More arguments */ )
{
std::vector<double> id_x_y_z;
// Now what's the best way to pass this vector to C#
}
Run Code Online (Sandbox Code Playgroud)
现在我的C#端看起来像这样:
using System;
using System.Runtime.InteropServices;
class HelloCpp
{
[DllImport("detector.dll")]
public static unsafe extern void detect_targets( string fn , /* More arguments */ );
static void Main()
{
detect_targets("test.png" , /* More arguments */ );
}
}
Run Code Online (Sandbox Code Playgroud)
我如何改变我的代码,以便将std :: vector从非托管C++传递给C#?