关于非托管这块一直没弄懂~~大家帮忙看下~c++下结构体定义~
struct pcap_if
{
struct pcap_if *next; /*自身结构体的嵌套* /
struct pcap_addr *addresses; /*另一个结构体的嵌套* /
char *name;
bpf_u_int32 flags;
};原函数模型:. void pcap_freealldevs (pcap_if *)
c#下对结构体的定义: public struct pcap_if
{
public System.IntPtr next; public string name; public string description; public System.IntPtr addresses;
} [DllImport("wpcap.dll", EntryPoint = "pcap_freealldevs", CharSet = CharSet.Ansi)]
static extern void text( IntPtr one);然后c#下如何写函数部分,才能让它调用成功,最后输出结构体里面的内容? 还有就是我这个text 函数的参数对吗?应该是intptr类型还是pcap_if类型?
struct pcap_if
{
struct pcap_if *next; /*自身结构体的嵌套* /
struct pcap_addr *addresses; /*另一个结构体的嵌套* /
char *name;
bpf_u_int32 flags;
};原函数模型:. void pcap_freealldevs (pcap_if *)
c#下对结构体的定义: public struct pcap_if
{
public System.IntPtr next; public string name; public string description; public System.IntPtr addresses;
} [DllImport("wpcap.dll", EntryPoint = "pcap_freealldevs", CharSet = CharSet.Ansi)]
static extern void text( IntPtr one);然后c#下如何写函数部分,才能让它调用成功,最后输出结构体里面的内容? 还有就是我这个text 函数的参数对吗?应该是intptr类型还是pcap_if类型?
你答复所有的帖子,都是这样一句话?to:楼主
参考资料,希望对你有所帮助:
1、Pinvoke的基本知识
2、C#与C/C++类型对照表