|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problems with my first DLL
I am writing my first apllication, which requires a DLL. I seem to be having problems and I am not exactly sure where the problem is.
The error I get in the main form is: [Error} datacollex.pas(113): Not enough actual parameters The DLL is as follows Code:
Library collexconv;
uses
ShareMem,
SysUtils,
Classes;
{$R *.res}
Function ExtNum (S: String): String; stdcall;
begin
ExtVar := copy(S,8,4);
end;
Function CallDir (S: String): String; stdcall;
InOut := copy(S,13,3);
end;
Function Extline (S: String): String; stdcall;
Line := copy(S,12,3);
end;
Function DateOfCall (S: String): String; stdcall;
CallDate := copy(S,21,2);
end;
Function MonthOfCall (S: String): String; stdcall;
CallMonth := copy(S,24,2);
end;
Function YearOfCall (S: String): String; stdcall;
CallYear := copy(S,27,2);
end;
Function TimeOfCall (S: String): String; stdcall;
CallTime := copy(S,30,5);
end;
Function LenOfCall (S: String): String; stdcall;
CallDur := copy(S,36,8);
end;
Function PhoneNum (S: String): String; stdcall;
Number := copy(s,60,27);
Number := StringReplace(Number, '.', '', [rfReplaceAll]);
end;
Function RingLen (S: String): String stdcall;
CallRing: = copy(S,89,5);
end;
Function AcctNum (S: String): String stdcall;
Account:= copy(S,106,16);
Account := StringReplace(Account, '.', '', [rfReplaceAll]);
end;
exports
ExtNum, CallDir, ExtLine, DateOfCall, MonthOfCall, YearOfCall, TimeOfCall,
LenOfcall, PhoneNum, RingLen, AcctNum;
end.
And the procedure I seem to be having a problem with: Code:
procedure TMainForm.CdrButtonOKClick(Sender: TObject); begin Assignfile(CdrText, CdrImportEdit.Text); Reset(CdrText); while not EOF(CdrText) do begin ReadLn (CdrText, Buffer1); OutgoingSQLEdit.Lines.Add := ExtVar(buffer1);// This is where the problem is indicated. end; CloseFile(CdrText); end; WhaDaYaTink? |
|
#2
|
|||
|
|||
|
I'm a bit further ahead, but still getting stuck.
In My Dll Project I Have: Code:
library collexconv;
uses
ShareMem,
SysUtils,
Classes,
StringConv in 'StringConv.pas';
exports
ExtNum, CallDir, ExtLine, DateOfCall, MonthOfCall, YearOfCall, TimeOfCall,
LenOfcall, PhoneNum, RingLen, AcctNum;
{$R *.res}
Begin
end.
I have the following in the unit: Code:
unit StringConv; interface uses SysUtils; implementation Var ExtVar : string; InOut : string; Line : string; CallDate : string; CallMonth : string; CallYear : string; CallTime : string; CallDur : string; Number : string; CallRing : string; Account : string; Function ExtNum (S: String): String; stdcall; begin ExtVar := copy(S,8,4); end; Function CallDir (S: String): String; stdcall; Begin InOut := copy(S,13,3); end; Function Extline (S: String): String; stdcall; Begin Line := copy(S,12,3); end; Function DateOfCall (S: String): String; stdcall; Begin CallDate := copy(S,21,2); end; Function MonthOfCall (S: String): String; stdcall; Begin CallMonth := copy(S,24,2); end; Function YearOfCall (S: String): String; stdcall; Begin CallYear := copy(S,27,2); end; Function TimeOfCall (S: String): String; stdcall; Begin CallTime := copy(S,30,5); end; Function LenOfCall (S: String): String; stdcall; Begin CallDur := copy(S,36,8); end; Function PhoneNum (S: String): String; stdcall; Begin Number := copy(s,60,27); Number := StringReplace(Number, '.', '', [rfReplaceAll]); end; Function RingLen (S: String): String stdcall; Begin CallRing := copy(S,89,5); end; Function AcctNum (S: String): String stdcall; Begin Account:= copy(S,106,16); Account := StringReplace(Account, '.', '', [rfReplaceAll]); end; end. I get the following error in the project: [Error] StringConv.pas(53): Undeclared identifier: 'ExtNum' What have I missed. |
|
#3
|
|||
|
|||
|
Finally got my head round it and it is all working. Next time I'll read the manual properly.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > Problems with my first DLL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|