[comp.lang.pascal] Seperate Compilation in Berkeley Pascal

iwm@doc.ic.ac.uk (Ian Moor) (08/06/89)

I am trying to compile a program consisting of several modules
(actually a translation of a Modula2 program) on various BSD machines:
Gould, Sun3, Ultrix Microvax and Mt Xinu vax. The program was developed on a Pyramid,
I think.  The Berkeley Pascal manual mentions that include files can contain 
constant,
type and variable declarations and also procedure/function headers followed
by the external directive. Now the trouble starts...

As the program arrived, all `modules' exporting items had one header file
e.g. foo.p has foo.h containing all public items with procedure headers, and
foo.p includes foo.h as do other files using foo. The compiler complained
that procedures in the header were declared twice. I got round this by
splitting the include files into two: types,constants and vars in one and
 procedure/function headers in the other, not including the second in the
defining file. This compiled ok on a Gould and Sun3 but at that point I
discovered that it was not possible to debug Pascal on the machines.

On moving to an Ultrix machine I discovered that before linking ALL header
files were scanned (never mind that they were not included in all files) and
duplication of procedure declarations in any files treated as an error. 
The solution to this is to have one declaration, with types and an external
directive in the defining file's header and a second definition with no
types -- like forward. But this will not port back to the other machines!

Does anybody know how seperate compilation should work in Berkeley Pascal ?