Code: Select all
dlportio.pas(5,10) Error: Found declaration: DlPortReadPortUchar(LongInt):Byte; StdCall;
dlportio.pas(30,10) Error: Calling convention doesn't match forward
Any help getting this to work would be GREATLY appreciated.
Code: Select all
dlportio.pas(5,10) Error: Found declaration: DlPortReadPortUchar(LongInt):Byte; StdCall;
dlportio.pas(30,10) Error: Calling convention doesn't match forward
Code: Select all
unit DLPortio ;
interface
Function DlPortReadPortUchar(Port:LongInt):byte; stdcall;
Function DlPortReadPortUshort(Port:LongInt):SmallInt; stdcall;
Function DlPortReadPortUlong(Port:LongInt):LongInt; stdcall;
Procedure DlPortReadPortBufferUchar(Port:LongInt;
var Buffer:Pointer; Count:LongInt); stdcall;
Procedure DlPortReadPortBufferUshort(Port:LongInt;
var Buffer:Pointer; Count:LongInt); stdcall;
Procedure DlPortReadPortBufferUlong(Port:LongInt;
var Buffer:Pointer; Count:LongInt); stdcall;
Procedure DlPortWritePortUchar(Port:LongInt; Value:byte); stdcall;
Procedure DlPortWritePortUshort(Port:LongInt; Value:SmallInt); stdcall;
Procedure DlPortWritePortUlong(Port:LongInt; Value:LongInt); stdcall;
Procedure DlPortWritePortBufferUchar(Port:LongInt;
var Buffer:Pointer; Count:LongInt); stdcall;
Procedure DlPortWritePortBufferUshort(Port:LongInt;
var Buffer:Pointer; Count:LongInt); stdcall;
Procedure DlPortWritePortBufferUlong(Port:LongInt;
var Buffer:Pointer; Count:LongInt); stdcall;
implementation
Function DlPortReadPortUchar; external 'inpoutx64.DLL';
Function DlPortReadPortUshort; external 'inpoutx64.DLL';
Function DlPortReadPortUlong; external 'inpoutx64.DLL';
Procedure DlPortReadPortBufferUchar; external 'inpoutx64.DLL';
Procedure DlPortReadPortBufferUshort; external 'inpoutx64.DLL';
Procedure DlPortReadPortBufferUlong; external 'inpoutx64.DLL';
Procedure DlPortWritePortUchar; external 'inpoutx64.DLL';
Procedure DlPortWritePortUshort; external 'inpoutx64.DLL';
Procedure DlPortWritePortUlong; external 'inpoutx64.DLL';
Procedure DlPortWritePortBufferUchar; external 'inpoutx64.DLL';
Procedure DlPortWritePortBufferUshort; external 'inpoutx64.DLL';
Procedure DlPortWritePortBufferUlong; external 'inpoutx64.DLL';
end.
Code: Select all
Errors:
dlportio.pas(29,10) Error: Calling convention doesn't match forward
dlportio.pas(5,10) Error: Found declaration: DlPortReadPortUchar(LongInt):Byte; StdCall;
dlportio.pas(30,10) Error: Calling convention doesn't match forward
dlportio.pas(6,10) Error: Found declaration: DlPortReadPortUshort(LongInt):SmallInt; StdCall;
dlportio.pas(31,10) Error: Calling convention doesn't match forward
dlportio.pas(7,10) Error: Found declaration: DlPortReadPortUlong(LongInt):LongInt; StdCall;
dlportio.pas(33,11) Error: Calling convention doesn't match forward
dlportio.pas(9,11) Error: Found declaration: DlPortReadPortBufferUchar(LongInt;var Pointer;LongInt);
dlportio.pas(34,11) Error: Calling convention doesn't match forward
dlportio.pas(11,11) Error: Found declaration: DlPortReadPortBufferUshort(LongInt;var Pointer;LongInt);
dlportio.pas(35,11) Error: Calling convention doesn't match forward
dlportio.pas(13,11) Error: Found declaration: DlPortReadPortBufferUlong(LongInt;var Pointer;LongInt);
dlportio.pas(37,11) Error: Calling convention doesn't match forward
dlportio.pas(16,11) Error: Found declaration: DlPortWritePortUchar(LongInt;Byte); StdCall;
dlportio.pas(38,11) Error: Calling convention doesn't match forward
dlportio.pas(17,11) Error: Found declaration: DlPortWritePortUshort(LongInt;SmallInt); StdCall;
dlportio.pas(39,11) Error: Calling convention doesn't match forward
dlportio.pas(18,11) Error: Found declaration: DlPortWritePortUlong(LongInt;LongInt); StdCall;
dlportio.pas(41,11) Error: Calling convention doesn't match forward
dlportio.pas(20,11) Error: Found declaration: DlPortWritePortBufferUchar(LongInt;var Pointer;LongInt);
dlportio.pas(42,11) Error: Calling convention doesn't match forward
dlportio.pas(22,11) Error: Found declaration: DlPortWritePortBufferUshort(LongInt;var Pointer;LongInt);
dlportio.pas(43,11) Error: Calling convention doesn't match forward
dlportio.pas(24,11) Error: Found declaration: DlPortWritePortBufferUlong(LongInt;var Pointer;LongInt);
dlportio.pas(47) Fatal: There were 24 errors compiling module, stopping
dlportio.pas(0) Fatal: Compilation aborted
then when it comes back into freepascal compiler, I haveThe application was unable to start correctly (0xc000007b). click ok to close the application.
Here's the unit that compiles:Program Exited with exitcode=123
Code: Select all
unit inpoutx64;
interface
Function DlPortReadPortUchar(Port:LongInt):byte;
Function DlPortReadPortUshort(Port:LongInt):SmallInt;
Function DlPortReadPortUlong(Port:LongInt):LongInt;
Procedure DlPortReadPortBufferUchar(Port:LongInt;
var Buffer:Pointer; Count:LongInt);
Procedure DlPortReadPortBufferUshort(Port:LongInt;
var Buffer:Pointer; Count:LongInt);
Procedure DlPortReadPortBufferUlong(Port:LongInt;
var Buffer:Pointer; Count:LongInt);
Procedure DlPortWritePortUchar(Port:LongInt; Value:byte);
Procedure DlPortWritePortUshort(Port:LongInt; Value:SmallInt);
Procedure DlPortWritePortUlong(Port:LongInt; Value:LongInt);
Procedure DlPortWritePortBufferUchar(Port:LongInt;
var Buffer:Pointer; Count:LongInt);
Procedure DlPortWritePortBufferUshort(Port:LongInt;
var Buffer:Pointer; Count:LongInt);
Procedure DlPortWritePortBufferUlong(Port:LongInt;
var Buffer:Pointer; Count:LongInt);
implementation
Function DlPortReadPortUchar; external 'inpoutx64.DLL';
Function DlPortReadPortUshort; external 'inpoutx64.DLL';
Function DlPortReadPortUlong; external 'inpoutx64.DLL';
Procedure DlPortReadPortBufferUchar; external 'inpoutx64.DLL';
Procedure DlPortReadPortBufferUshort; external 'inpoutx64.DLL';
Procedure DlPortReadPortBufferUlong; external 'inpoutx64.DLL';
Procedure DlPortWritePortUchar; external 'inpoutx64.DLL';
Procedure DlPortWritePortUshort; external 'inpoutx64.DLL';
Procedure DlPortWritePortUlong; external 'inpoutx64.DLL';
Procedure DlPortWritePortBufferUchar; external 'inpoutx64.DLL';
Procedure DlPortWritePortBufferUshort; external 'inpoutx64.DLL';
Procedure DlPortWritePortBufferUlong; external 'inpoutx64.DLL';
end.
Code: Select all
Program porttest;
Uses inpoutx64;
Var Portnum:integer;
Portdata,portdata2,portdata3:byte;
Begin
Write('Enter Port Number: ');
Readln(portnum);
portdata:=DlPortReadPortUchar(portnum);
portdata2:=DlPortReadPortUchar(portnum+1);
portdata3:=DlPortReadPortUchar(portnum+2);
writeln('Port ',portnum,': ',Portdata,' ',Portdata2,' ',Portdata3);
Write('Enter New Data: ');
readln(portdata);
DlPortWritePortUchar(portnum,portdata);
portdata:=DlPortReadPortUchar(portnum);
portdata2:=DlPortReadPortUchar(portnum+1);
portdata3:=DlPortReadPortUchar(portnum+2);
writeln(Portdata,' ',Portdata2,' ',Portdata3);
readln;
end.
Code: Select all
unit inpout32;
interface
Function IsInpOutDriverOpen:boolean;
Function IsXP64Bit:boolean;
Function Inp32(Port:SmallInt):Byte;
Procedure Out32(Port:SmallInt; Value:Byte);
Function DlPortReadPortUchar(Port:SmallInt):Byte;
Function DlPortReadPortUshort(Port:SmallInt):Word;
Function DlPortReadPortUlong(Port:SmallInt):Cardinal;
Procedure DlPortWritePortUchar(Port:SmallInt; Value:Byte);
Procedure DlPortWritePortUshort(Port:SmallInt; Value:Word);
Procedure DlPortWritePortUlong(Port:SmallInt; Value:Cardinal);
implementation
Function IsInpOutDriverOpen; external 'inpout32.DLL';
Function IsXP64Bit; external 'inpout32.DLL';
Function Inp32; external 'inpout32.DLL';
Procedure Out32; external 'inpout32.DLL';
Function DlPortReadPortUchar; external 'inpout32.DLL';
Function DlPortReadPortUshort; external 'inpout32.DLL';
Function DlPortReadPortUlong; external 'inpout32.DLL';
Procedure DlPortWritePortUchar; external 'inpout32.DLL';
Procedure DlPortWritePortUshort; external 'inpout32.DLL';
Procedure DlPortWritePortUlong; external 'inpout32.DLL';
end.
Code: Select all
Program porttest;
Uses inpout32;
Var IsInpOutOpen,IsXP64:boolean;
Portnum:smallInt;
Port_data:byte;
Procedure Readloop;
var
loop_count:integer;
port_read:byte;
Begin
for loop_count:=1 to 2 do
begin
port_read:=0;
port_read:=inp32(portnum);
{port_read:=DlPortReadPortUchar(portnum);}
writeln('Port ',portnum,': ',Port_read);
end;
end;
Begin
IsInpOutOpen:=IsInpOutDriverOpen;
IsXP64:=IsXP64Bit;
writeln('Is InpOut Driver Open: ',IsInpOutOpen,' Is 64Bit: ',IsXP64);
Write('Enter Port Number: ');
Readln(portnum);
Readloop;
repeat
Begin
Write('Enter New Data: ');
readln(port_data);
DlPortWritePortUchar(portnum,port_data);
{out32(portnum,port_data);}
readloop;
end
Until
Port_data=$0;
end.