Board index » delphi » Called a procedure from a 'uses'ed unit

Called a procedure from a 'uses'ed unit

What's wrong with me?!  I though that by including a new unit's
name within a uses clause, all the procedures you write in the
implementation section are now available from that unit.  
Right?  So then, why do I get 'unidentified identifier' when
trying to call a procedure I wrote in a new unit, and included
that unit's name within the uses clause of the calling unit?!

e.g.:

unit A

uses
  ..., UnitB, ...

implementation

procedure DoIt();
  DefinedProc(a, b);   <--- unidentified?!?! WHY??
end;

end.

unit B

implementation

procedure DefinedProc(a, b: Integer);
begin
  MessageDlg('Wow!', mbInformation, [mbOK], 0);
end;

end.

-Dave
--
-=[ dave @ delbruck.pharm.sunysb.edu ]=-

 

Re:Called a procedure from a 'uses'ed unit


Quote
David Eisenberg <d...@delbruck.pharm.sunysb.edu> wrote:
>What's wrong with me?!  I though that by including a new unit's
>name within a uses clause, all the procedures you write in the
>implementation section are now available from that unit.  
>Right?  So then, why do I get 'unidentified identifier' when
>trying to call a procedure I wrote in a new unit, and included
>that unit's name within the uses clause of the calling unit?!

end.

Quote
>unit B

{ you have to declare DefinedProc here for it to be visible to units
referencing Unit B  - I bet you've discovered that by now havent you?}

Quote
>implementation
>procedure DefinedProc(a, b: Integer);
>begin
>  MessageDlg('Wow!', mbInformation, [mbOK], 0);
>end;

[snip]
regards
Michael Glover

Other Threads