[fpc-pascal] using functions from units & main programme

Sven Barth pascaldragon at googlemail.com
Fri Nov 18 21:17:25 CET 2011


On 18.11.2011 18:15, Bart wrote:
> {file: prog.pas}
> Program Prog;
> {$ifdef fpc}
>    {$mode objfpc}{h+}
> {$endif}
>
> uses jim;
>
> function fna: string;
> begin
>    fna := 'Prog';
> end;
>
> begin
>    writeln('fna = ',fna);
>    writeln('jim.fna = ,'jim.fna);
> end.
>
> Compiled with both TurboPascal 6.0 and fpc 2.4.4. the output in both
> cases is "Prog".
> To get "Jim" in the main program file (prog.pas) I have to use jim.fna
> explicitely:

But he wants to call "fnb" in the main program and have that call "fna" 
of the main program instead of "fna" from "jim".

Regards,
Sven



More information about the fpc-pascal mailing list