[net.lang.pascal] Help on separate compilation: VMS to unix port

doug@escher.UUCP (Douglas J Freyburger) (08/14/85)

	I am porting a large program from VMS in VAX PASCAL
to vax unix bsd 4.2 berkeley pascal.  This program makes
extensive use of separate compilation (many screenfulls of
constants, data types, globals, and externals).  I have been
unable to make it work according to the berkeley pascal
manual, and I am wondering if anyone sees what I am doing
wrong.

	In the separate module (which is on the order of
10,000 lines of Pascal), I removed the first and
last line (module ...; and end.) that are analogous to
program ...; and end., I changed all of the "extern"s to
"external"s, and I case flushed everything not in quotes or
comments to lower case.  I also changed the %include of the
file defining the const, type, and var's to a #include, and
the %include of the file defining all of the extern's to a
#include.

	When I compile the separate module
"pc -c module.p", I get module.o without any problems, but
trying to link it back into the rest of the program just
never works.

1)	If I try to link it by hand:
pc -c user.p
ld -o user user.o module.o ...
user
	I get the error message:
reference to an inactive file, core dumped
	Which, of course, is not in any manual I've found.

2)	If I let the "pc" script link it for me:
pc user.p module.o
	I get dozens of screens of error messages, one for
every single constant, data type, global, and routine used.
It thinks they are multiply defined.  They are defined by
the same include files, which are #include'd into both
user.p and module.p, but why does it think they are defined
in several places?

	Has anyone had this problem and found their way
through?  Does anyone have any idea what I'm doing wrong?
Any help, even a pointer to a cheap Pascal-to-C translator
that is VERY lenient about externals, would be a godsend.

	Noone at JPL has used the separate compilation features
in berkeley pascal.  Everyone I asked has said "Why don't
you translate it to C?"  I have to reply that for this program,
I am not allowed the choice.  Most of my other work is in C,
and I've never run across a separate compilation problem with C.

-- 

Doug Freyburger		DOUG@JPL-VLSI, DOUG@JPL-ROBOTICS,
JPL 171-235		...escher!doug, doug@aerospace,
Pasadena, CA 91109	etc.

Disclaimer: The opinions expressed above are far too
ridiculous to be associated with my employer.

Unix is a trademark of Bell Labs, VMS is a trade mark of
DEC, and there are others that I'm probably forgeting to
mention.