DllImport for C#(原文为C+;+;/CLI)需要输出数组
这就是C++中的情况:DllImport for C#(原文为C+;+;/CLI)需要输出数组,c#,pointers,c++-cli,dllimport,C#,Pointers,C++ Cli,Dllimport,这就是C++中的情况: [DllImportAttribute("Win32DLLRecon.dll", CharSet=CharSet::Auto, CallingConvention=CallingConvention::StdCall)] extern "C" void proc1 (__int32 *i1, __int16 *i2, __int16 *i3, char *i4,
[DllImportAttribute("Win32DLLRecon.dll", CharSet=CharSet::Auto, CallingConvention=CallingConvention::StdCall)]
extern "C" void proc1
(__int32 *i1,
__int16 *i2,
__int16 *i3,
char *i4,
unsigned *i5,
unsigned char *o1,
unsigned __int16 *o2,
float *o3);
其中i=输入,o=输出
什么是C#等价物?我试图指定like数组,例如“out Byte[]output”,但它抱怨它需要Byte*,而不是Byte[](我确实需要在代码中使用指针)。 编辑:
如果我只是声明我的整个类是不安全的,并将它们作为指针传递:extern proc(out Byte*output,等等)?我认为您需要使用
System.IntPtr
来实现此目的,或者使用System.IntPtr[]
来实现真正的数组。我可以将其用于Byte和SByte吗?你有什么例子吗?如果我只是声明我的整个类是不安全的,并将它们作为指针传递:extern proc(out Byte*output,等等)?参数名称和注释是精心设计的,不会得到答案。我修改了名称,希望现在更清楚。请有人看一下!!!