L
ljgxn
Unregistered / Unconfirmed
GUEST, unregistred user!
一个c写的dll其中一个函数<br>SMGPDeliver(const int nTimeoutIn, DeliverResp *pDeliverResp);<br>其中 DeliverResp定义如下<br>#ifdef SMGP_API_EXPORTS<br>/*DLL VERSION*/<br>typedef struct<br>{<br> unsigned int nIsReport;<br> unsigned int nMsgFormat;<br> unsigned int nMsgLength;<br> char sMsgID[10+1];<br> char sRecvTime[14+1];<br> char sSrcTermID[21+1];<br> char sDestTermID[21+1];<br> char sMsgContent[252+1];<br>}DeliverResp;<br><br>#else<br>/*NOT DLL VERSION*/<br>typedef struct<br>{<br> char sMsgID[10+1];<br> unsigned int nIsReport;<br> unsigned int nMsgFormat;<br> char sRecvTime[14+1];<br> char sSrcTermID[21+1];<br> char sDestTermID[21+1];<br> unsigned int nMsgLength;<br> char sMsgContent[252+1];<br>}DeliverResp;<br><br><br>我在delphi中定义如下<br>{+//DLL VERSION*/ }<br>type<br> gDeliverResp= ^DeliverResp;<br> DeliverResp = record<br> nIsReport: word;<br> nMsgFormat: word;<br> nMsgLength: word;<br> sMsgID: Array[0..10] of Char;<br> sRecvTime: Array[0..14] of Char;<br> sSrcTermID: Array[0..21] of Char;<br> sDestTermID: Array[0..21] of Char;<br> sMsgContent: Array[0..252] of Char;<br> end {DeliverResp};<br><br>function SMGPDeliver(const nTimeoutIn: Integer;<br> pDeliverResp: gDeliverResp): Integer ; stdcall ;<br>我转成delphi的定义有没有错?<br><br>程序中这样使用的:<br>procedure TForm1.Button2Click(sender:Tobject);<br>var<br>g_d:gDeliverResp;<br>timeout:integer;<br>begin<br> getmem(g_d,sizeof(DeliverResp));<br> timeout:=0;<br> nRetcode:=SMGPDeliver(timeout,g_d);<br><br>end;<br>我的调用程序有没有问题?我要g_d中各项的值怎么取啊?