module lib(input,output);

procedure print_globals; external; asmname 'print_globals';

var global_int:integer;               asmname 'global_int';
    global_str:string(40);            asmname 'global_str';

procedure print_globals;
begin
        if global_int = 100 then
          writeln ( global_str )
        else
          writeln ( 'failed' )
end;

end.

program main(input,output);

{$init-modules=lib}

{ I added the asmnames -- I don't think variables in implementations
  of units/modules have to be globally accessible (on the linker
  level) normally. -- Frank }

var global_int: integer; external;    asmname 'global_int';
    global_str: string(40); external; asmname 'global_str';

procedure print_globals; external; asmname 'print_globals';

begin
        global_int:=100;
        global_str:='OK';
        print_globals;
end.
