Number: 15 Category: gpc Synopsis: Emulation of Borland Pascal 'Assign' procedure does not work in separate unit Confidential: no Severity: serious Priority: medium Responsible: peter (Peter Gerwinski) State: open Class: sw-bug Submitter-Id: www Arrival-Date: Sat Jan 11 17:00:00 1997 Originator: Axel Mellinger Organization:
UC Berkeley
Release: 2.0(2.7.2.1) Environment:
Linux 2.0.20
Description:
Emulation of the Borland Pascal 'Assign' procedure (as suggested in the gpc.info) does not work if the 'Assign' procedure is put into a separate unit. Execution of the program 'test.pas' (see below) results in the error message
%Gpc: Could't open bound file. Doing `unbind(F)'
and a file named '\264\316\b@\264\316\b@\020' is created instead of 'test.dat'.
How-To-Repeat:
(* begin 'test.pas' *) (* compile with 'gpc -o test --automake test.pas' *)
program test;
uses borland; var f: text;
begin assign(f, 'test.dat'); rewrite(f); writeln(f, 'Success.'); close(f); end. (* end 'test.pas' *)
(* begin 'borland.pas' - this goes into a separate file *) unit borland;
INTERFACE
procedure Assign(var t: text; protected Name: string);
IMPLEMENTATION
procedure Assign(var t: text; protected Name: string); var b: BindingType; begin unbind(t); b := binding(t); b.Name := Name; bind(t, b); b := binding(t); end;
end. (* end 'borland.pas' *)
Fix:
Above example works fine when the 'Assign' procedure is put into the main program instead of a separate unit.
Audit-Trail: Unformatted: