请高手指教:调用vc写的dll的问题(100分)

H

huangjf

Unregistered / Unconfirmed
GUEST, unregistred user!
我用delphi调用vc写的aaa.dll,里面有一个函数:<br>&nbsp; int test(unsigned char a,_int64 *b)<br><br>但是我不知道这两种类型的变量如何对应delphi中的类型。<br><br>我的源程序是:<br>interface<br>&nbsp; type<br>&nbsp; Pint=^int64;<br>&nbsp; ......<br>&nbsp; function test(a: word; b: Pint): integer;cdecl;<br>......<br>implementation<br>&nbsp; function test;external 'aaa.DLL' name 'test';<br>......<br>&nbsp; procedure callDll;<br> var<br> ret:integer;<br> &nbsp; b: int64; &nbsp;<br>&nbsp; begin<br>&nbsp; b := 0;<br>&nbsp; ret: = test(0,@b);<br>&nbsp; end;<br><br><br>对于unsigned char a,我试着用了byte,word,longword,<br>都不行<br><br>非常感谢你的指教
 
试试integer<br>也有可能是int64的问题,不知道c的格式是否一样<br><br>-----<br>http://www.8421.org
 
unsigned char 就是 byte<br>_int64 * 是 PInt64
 
看你的调用方法除了 unsigned char &nbsp;应该是 byte,其他没什么问题<br>你说不行,不知道是什么不行啊。<br>要是不能找到函数入口,那是vc把test这个名字变了<br>要是调用返回的时候出错,那是cdecl不对,你确定vc是用cdecl的吗,还是stdcall的?<br>
 
对不起,我忘了说了,相同的这个DLL里面我别的函数(也就是参数只有int, char * 等简单的类型)已经能够调用了,<br>stdcall我也试过了,但是还是不行
 
你说这个test不行,是执行出现错误(非法操作),还是正常执行,但是没有效果?
 
int test(unsigned char a,_int64 *b)<br>function test(a:byte,var b:int64):integer;cdecl;试试看<br><br>
 
顶部