关于动态库调用,高手请指教(10分)

  • 主题发起人 主题发起人 superkkbj
  • 开始时间 开始时间
S

superkkbj

Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个C的DLL,传参为一个自定义STRUCT。<br>我用VB,C都试过了,DLL工作正常,结果用DELPHI调用就不行。有谁遇到过类似的问题?怎么解决?<br><br>
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=2552260
 
var<br>&nbsp; &nbsp;OneHandle:THandle;<br>&nbsp; &nbsp;vv:^Integer;<br>begin<br>&nbsp; &nbsp;OneHandle:=LoadLibrary(pchar(extractfilepath(application.exename)+'spserver.dll'));<br>&nbsp; &nbsp;try<br>&nbsp; &nbsp; &nbsp; if OneHandle&lt;&gt;0 then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;vv:=GetProcAddress(OneHandle,'VSPPCommInit');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if @vv&lt;&gt;nil then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if @vv(12199,1)=0 then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showmessage('success')<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showmessage('faild');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseLastWin32Error;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp;finally<br>&nbsp; &nbsp; &nbsp; FreeLibrary(OneHandle);<br>&nbsp; &nbsp;end;<br>这样为什么不行呢? dll中确实有VSPPCommInit函数!
 
我想我没有表达清除。<br>我不是不会调用,而是我在比对C,VB和DELPHI的调用结果后觉得不一致。我的DELPHI的数据类型都与C调用时是匹配的。为什么会出现这样不同的结果,我很疑惑。有什么工具可以帮助分析的?
 
&nbsp; &nbsp; &nbsp; 两种语言分别具体怎么定义的?贴。。。。
 
后退
顶部