[lazarus] calling a procedure from another pas file

Vincent Snijders vslist at zonnet.nl
Sat Dec 27 09:29:46 EST 2003


Do you have 
procedure kocsi_olvas (hogy_mit: char; marka: string; tipus: string);
in the interface section of the unit main?

HTH,
Vincent.

On Sat, 27 Dec 2003 15:24:20 +0100
LeVA <leva at az.isten.hu> wrote:

> I have a main.pas file.
> main.pas:
> 
> ----------------------------###----------------------------
> procedure kocsi_olvas (hogy_mit: char; marka: string; tipus: string);
>      var     sor       :string[255];
>              i         :byte;
> 
>      const   kocsi_file='kocsi.lst';
> begin
>     blabla
>     case hogy_mit of
>          'm': begin blabla end;
>          't': begin blabla end;
>          'r': begin blabla end;
>     end;
> end;
> ----------------------------###----------------------------
> 
> 
> I have a test.pas file.
> test.pas:
> 
> ----------------------------###----------------------------
> ..
> ...
> ....
> .....
> var
>    Form6: TForm6;
> 
> implementation
> 
> uses
>     main;
> 
> { TForm6 }
> 
> { TForm6 }
> 
> { TForm6 }
> 
> procedure TForm6.Form6Show(Sender: TObject);
>      var     marka  : string[255];
>              tipus  : string[255];
>              sor    : string[255];
>              i      : integer;
> 
> begin
>     blabla
>     while markak[i]<>'' do
>       begin
>        blabla
>        kocsi_olvas('t',markak[i],'tipus');
>        blabla
>       end;
> end;
> ----------------------------###----------------------------
> 
> 
> And when I build the project, I get this in the messages window:
> 
> ----------------------------###----------------------------
> TOutputFilter: "test.pas(55,12) Error: Identifier not found
> "kocsi_olvas"" TOutputFilter: "test.pas(55,46) Error: Illegal
> expression" TOutputFilter: "test.pas(113) Fatal: There were 2 errors
> compiling module, stopping"
> ----------------------------###----------------------------
> 
> 
> 
> I thought that specifying the 'main' in the uses section is enough for
> 
> calling the procedure. I can read/write the main.pas's variables, but 
> can not call the main.pas's 'kocsi_olvas' procedure.
> 
> Thanks for the help!
> 
> Daniel
> 
> 
> -- 
> LeVA
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives







More information about the Lazarus mailing list