[TUHS] where did "main" come from?

Charles Anthony charles.unix.pro at gmail.com
Sat May 23 08:08:15 AEST 2020


On Fri, May 22, 2020 at 11:54 AM Lawrence Stewart <stewart at serissa.com>
wrote:

>  I can’t find an online copy of the Bell Laboratories BCPL manual
> (Canaday/Thompson) from 1969 or anything about how to use BCPL on Multics
> or CTSS.


In general, Multics does not have a concept of "main"; the entry point of a
program is the name of the program. Looking at the Multics runoff sources
(written in BCPL) we see in the segment runoff_driver.bcpl:

external
     $(   RunoffCommand = "runoff"
...


let RunoffCommand () be main
     $(   MONITOR := Open (StreamName + Write, "error_output")        //
 Errors, etc. written here.
...

BCPL replaces the name RunoffCommand with runoff during compilation; the
compiled segment runoff_driver will have an entry point "runoff". Entering
the command "runoff" will search segments in the search path for that entry
point.

Since segments can have multiple entry points, the idea of "main" (or
"start" or "start_") as the defining entry point is not meaningful in
Multics.

The Multics C compiler (based on PCC) does have a  concept of main; the C
linker aliases that to the segment name, making the entry point name the
same as the segment name. Thus compiling and linking foo.c generates a
segment foo with an entry point foo, which points to main. (Actually, it
aliases it to the C runtime library initialization which calls main.)

-- Charles
-- Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200522/b3aae016/attachment.htm>


More information about the TUHS mailing list