0

vc++ dll中有一个函数。

void fun(unsigned int nchannel,int nFGHandle,void* i);

现在我想在我的 c# 代码中调用这个 dll。我是这样使用的,

[DllImport ("AVC.dll")]
public static extern void fun(UInt32 a,int b,ref void c );

所以我想问

  1. 有没有必要编组?
  2. 如何在 C# 中将ref 用于void* i
4

1 回答 1

2

据我所知,您使用IntPtrto marshal void *,但是,如果您需要返回值,您可以直接使用out <type>并有几个重载,例如:

[DllImport ("AVC.dll")]
public static extern void fun(UInt32 a,int b, out int c );
[DllImport ("AVC.dll")]
public static extern void fun(UInt32 a,int b, out float c );

等等

于 2012-06-22T05:50:12.993 回答