VB下的dll文件调用申明如下:请问DELPHI下因该怎样声明???3xDeclare Function read_ch_data Lib "k800.dll" (ByVal nPort As Integer, ByVal ch As Byte, ByVal d1 As Long, ByVal d2 As Long) As Integer
Declare Sub out_port Lib "k800.dll" (ByVal nPort As Integer, ByVal cValue As Byte)
Declare Function in_port Lib "k800.dll" (ByVal nPort As Integer) As Byte

解决方案 »

  1.   

    function read_ch_data (var nPort:integer;var ch:Byte;var d1,s2:LONG;):Integer;stdcall extern "k800.dll"
    其他雷同
      

  2.   

    unit Unit2;interfacefunction read_ch_data(nPort: Integer; ch: Byte; d1: Integer; d2: Integer): Integer;procedure out_port(nPort: Integer; cValue: Byte);function in_port(nPort: Integer): Byte;implementationfunction read_ch_data; external 'k800.dll' name 'read_ch_data';procedure out_port(nPort: Integer; cValue: Byte); external 'k800.dll' name 'out_port';function in_port(nPort: Integer): Byte; external 'k800.dll' name 'in_port';
    end.
      

  3.   

    firetoucher(风焱) 说的有些不太对,VB中的byValu是传值方式,byRef才是按传引用的方式传参的。在delphi中byRef对应得加个var,byvalue的话不用加var.
      

  4.   

    ouyang75928(Thinking in Pascal) 
    说的没错,这回又晚了