请问Delphi能不能调用VB写的DLL,为什么这的会出错,代码如下:
var
  Form1: TForm1;
  function GetRecordCount(ComPortNo, ComPortSpeed, MachineNo, RecordCount:integer):integer; external 'IccodeA.dll' ;implementation
 {$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
var
  rc : integer;
begin
  GetRecordCount(1,9600,1,rc);
end;
结果一编译就提示:无法定位程序输入点 GetRecordCount 于动太链接庫IccodeA.dll上。DLL说明
******************
所有函数返回值:返回短整型
1 通信口连接超时
2 操作超时
8 操作成功
7 找不到卡钟
255 传入机号大于255
所有函数公共传入参数:
ComPortNo 必需的。 短整型值,传入的通讯口号。可为下列之一:1,2,3,4
ComPortSpeed 必需的。 长整型值,传入的通讯口号速率。可为下列之一:9600,19200,38400,57600,115200
MachineNo 必需的。 短整型值,传入的机器号。范围为:0-255GetRecord模块只用于收集卡钟数据,只有两个方法成员:GetRecordCount 和 GetRecord
GetRecordCount(ComPortNo, ComPortSpeed, MachineNo, RecordCount) 返回值:短整型说明:用于取卡钟内刷卡记录总数。
参数
RecordCount 必需的。长整型,用于返回指定卡钟内存放的记录总数。
GetRecord(ComPortNo, ComPortSpeed, MachineNo, CurrentGetTimes,GotRecord() )返回值:短整型说明:用于收集卡钟数据。每调用一次GotRecord()数组返回64条记录。一般先调用GetRecordCount取卡钟内记录总数,确定调用GetRecord次数,再循环调用GetRecord函数取记录。在取完记录后调用SetMachine.DeleteAllData函数将所有刷卡记录删除。
参数
CurrentGetTimes 必需的。长整型值。只调用一次本函数时,CurrentGetTimes设为1。当卡钟内记录数超过64条,需要循环调用时,第一次调用时CurrentGetTimes必须为1,第二次到最后一次不能为1,否则只取总记录的前64条。一般CurrentGetTimes设为每调用一次加1。GetRecord调用间隔不能少于150毫秒,否则卡钟会因等不到命令而不发送数据,GetRecord返回2取记录超时。一般把64条记录写入硬盘后应马上进行下一次调用。
GotRecord() 必需的。 一维字符串数组,用于返回刷卡记录,每次调用返回64条记录。最后一次调用若不足64条则按实际条数返回。
********************

解决方案 »

  1.   

    注意函数名的大小写必须与vb的dll是一致的。
      

  2.   

    function GetRecordCount(ComPortNo, ComPortSpeed, MachineNo, RecordCount:integer):integer; far;external 'IccodeA.dll' ;
    或者这样试试
    function GetRecordCount(ComPortNo, ComPortSpeed, MachineNo, RecordCount:integer):integer;stdcall;external 'IccodeA.dll' ;
      

  3.   

    注意函数名的大小写必须与vb的dll是一致的。
      

  4.   

    我自己搞定,同ActiveX一样使用。
      

  5.   

    function GetRecordCount(ComPortNo, ComPortSpeed, MachineNo, RecordCount:integer):integer; external 'IccodeA.dll' ;从这句来看你没有使用调用约定。
    在没有调用约定的情况下,delphi使用register作为调用约定。检查你VB写的dll的调用约定;一般大多使用的是stdcall约定。这时你的声明应该是
    function GetRecordCount(ComPortNo, ComPortSpeed, MachineNo, RecordCount:integer):integer; stdcall; external 'IccodeA.dll' ;