C# 调用 c++dll 参数为结构体 求大神指教

xzm71908 2013-04-18 09:55:27
c++ dll代码如下:
#pragma pack(1)
//////////////////////////////////////////////////////////////////////////
typedef unsigned long bpf_u_int32;
struct pcap_pkthdr
{
struct timeval ts; /* time stamp */
bpf_u_int32 caplen; /* length of portion present */
bpf_u_int32 len; /* length this packet (off wire) */
};

typedef struct _proto_node
{
struct _proto_node *first_child;
struct _proto_node *last_child;
struct _proto_node *next;
struct _proto_node *parent;
char* protoinfo;

_proto_node()
{
first_child = NULL;
last_child = NULL;
next = NULL;
parent = NULL;
protoinfo = NULL;
};

} proto_node;

#define PAKINFO_LEN 1024
#define ADDR_LEN 32
//数据包列表信息
struct SPacketListInfo
{
int nNumber;
float fTimeStamp;

char szSurAddr[ADDR_LEN];
char szSurAddrEx[ADDR_LEN];
char szDesAddr[ADDR_LEN];
char szDesAddrEx[ADDR_LEN];

char szAPBSSID[ADDR_LEN];

char szProtocol[ADDR_LEN];
char szInfor[PAKINFO_LEN];

int nFrameSubType;
int nNoise;
int nFCS;
float fRate;
bool bRetry;
};

int __stdcall CreatDecodeObject();
int __stdcall PacketDecode(int nObject,pcap_pkthdr *pkhead,SPacketListInfo* packList,proto_node** protoTree);

//////////这是c++里面的调用 那么我在c#当中该如何调用呢? 如何传正确的参数
/*c++里面的调用:*/
int nObject = CreatDecodeObject();
pcap_pkthdr hdr;
SPacketListInfo stPakInfo;
proto_node* pNode = NULL;
int nRet = PacketDecode(nObject,&hdr,&stPakInfo,&pNode);

本人不懂c++
请问我在C# 当中如何才能的正确调用 该dll
跪求C# 调用源码 急~~~~~~~
...全文
170 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Code従業員 2013-04-22
  • 打赏
  • 举报
回复
跟引用API一个样
龙行者 2013-04-22
  • 打赏
  • 举报
回复
C#调用C++dll http://www.cnblogs.com/ysharp/archive/2012/05/25/2517803.html
风一样的大叔 2013-04-18
  • 打赏
  • 举报
回复
metoer 2013-04-18
  • 打赏
  • 举报
回复
使用导入dll,网上例子一堆 http://blog.sina.com.cn/s/blog_68c4a1b50100u3kn.html
xzm71908 2013-04-18
  • 打赏
  • 举报
回复
自己顶一个,跪求啊

110,572

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧