Link to home
Start Free TrialLog in
Avatar of lfgmartins
lfgmartins

asked on

Forward declaration error

Hi,

Please see the following code. I want to forward declare these 2 subroutines, whatelse I can't use them on the routines that I've in the interface part because they are not known if I don't forward declarew them. See below for more details. Thanks
function init_mail:integer;
procedure end_mail;

unit xEml;
interface
 
Function send_mail(const Para, Cc, Bcc: array of string; const subject: String; const body, Attachments: array of string): Integer;
Function send_fax(const numero, mensagem, documento: String): Integer;
 
implementation
uses Email;

---- ERROR I've to forward declare this 2 subroutines in the interface part, or whatelse I've an error in the initizialization part: 'BEGIN' expexted but 'INITIALIZATION' found. I want to declare them in the implementation part for them to be hidden for other units

function init_mail:integer;
procedure end_mail;
 
var
  email_activo : Boolean;
  Envio_Mapi : TEmail;
 
Function send_mail(const Para, Cc, Bcc: array of string; const subject: String; const body, Attachments: array of string): Integer;
var
  i: Integer;
begin
  // Inicializa o Mapi
  Result := init_mail();
  if result <> EMAIL_OK then
    exit;
end;
 
Function send_fax(const numero, mensagem, documento: String): Integer;
begin
end;
 
function init_mail:integer;
begin
end;
 
procedure end_mail;
begin
end;
 
initialization
  init_mail;
 
finalization
  end_mail;
 
end.
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

I think you may need to declare the merhods as forward

function init_mail:integer; forward;
procedure end_mail; forward;
ASKER CERTIFIED SOLUTION
Avatar of geobul
geobul

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial