The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> Delphi Programming
|
Problems with my first DLL
Discuss Problems with my first DLL in the Delphi Programming forum on Dev Shed. Problems with my first DLL Delphi Programming forum discussing Delphi related topics including Kylix, C++ Builder, and more. Delphi is a high-performance language, originally based on the PASCAL language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 6th, 2003, 11:50 AM
|
|
Contributing User
|
|
Join Date: May 2002
Location: UK
Posts: 563

Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
|
|
|
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?
|

December 6th, 2003, 05:38 PM
|
|
Contributing User
|
|
Join Date: May 2002
Location: UK
Posts: 563

Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
|
|
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.
|

December 7th, 2003, 01:48 PM
|
|
Contributing User
|
|
Join Date: May 2002
Location: UK
Posts: 563

Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
|
|
|
Finally got my head round it and it is all working. Next time I'll read the manual properly.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|