Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 6th, 2003, 11:50 AM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 521 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 16 h 42 m 8 sec
Reputation Power: 7
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?

Reply With Quote
  #2  
Old December 6th, 2003, 05:38 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 521 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 16 h 42 m 8 sec
Reputation Power: 7
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.

Reply With Quote
  #3  
Old December 7th, 2003, 01:48 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 521 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 16 h 42 m 8 sec
Reputation Power: 7
Finally got my head round it and it is all working. Next time I'll read the manual properly.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Problems with my first DLL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway