MULTICS TECHNICAL BULLETIN MTB-761-00 To: MTB Distribution From: Doug Robinson Date: January 5, 1987 Subject: Multics C Overview ----------------------------------- This document provides and overview of the C implementation on Multics. It also serves as a directory to other MTBs that deal with specific topics to do with the implementation. ----------------------------------- Comments on this MTB should be sent to the author - via Multics mail to: DRobinson@System-M via telephone to: ACTC (403) 284-6400 _________________________________________________________________ Multics project internal documentation; no to be reproduced or distributed outside the Multics project. Multics C Overview MTB-761-00 TABLE OF CONTENTS Section Page Subject ======= ==== ======= 1 1 Introduction 2 2 The Compiler 3 3 The C Execution Environment 4 4 The C Runtime Library 5 4 Hard Core 6 4 The Linkage Editor 7 4 ALM Multics C Overview MTB-761-00 1. Introduction This MTB introduces the 'cc' command, outlines the major facets of the C project, and directs the reader to more detailed information in other documents. The Multics C compiler was primarily developed to facilitate the porting of third party software to Multics. It is an unfortunate fact of life that most computer systems are very different from Multics, which causes much grief during almost any port. In order to help users with these problems, the following steps have been taken: the linkage- editor (LE) was developed, hard core changes were affected, a C execution environment was built, the C runtime package was written, and a few changes were made to ALM. Please note that the Multics C compiler is to be considered third-party software. MTB-761-00 Multics C Overview 2. The Compiler Syntax: cc filename1, ..., filenameN {-control_args} Function: "cc" is the Multics C compiler command. It accepts as input C source programs and/or assembled or compiled programs, and creates one of various output file types. Arguments: filename Any filename with a suffix of '.c' is taken as a C source file and is compiled. Any filename suffixed with '.alm' is passed to alm. Any filename suffixed with '.cpp' is taken as a preprocessor output file, and is passed to the parser. All other filenames are given as input to the linkage editor. Control arguments: -brief, -bf suppresses printing of messages stating the current pass being performed. (Default) -definition args, -def args specifies define names to be defined or undefined in the preprocessor. "args" is a list of define names separated by commas with no spaces, in the following form: -def n,x=2,^y In this example, the first argument specifies that n is to be defined as 1 (in the same way as '#define n' would define n to 1). The second argument specifies that x is to be given a definition of 2, and the last argument specifes that y is to be undefined in the preprocessor. -include paths, -incl paths specifies the pathnames of include file directories in which the preprocessor will look for include files. All arguments up to the next control argument are treated as include directory pathnames. -library paths, -lb paths specifies the pathnames of library directories, archives or object files for the linkage editor to use when resolving external references. All arguments up to the next control argument are treated as include library pathnames. Multics C Overview MTB-761-00 -long, -lg specifies that a message should be printed specifying the completion of each pass of the compiler for each specified filename. -output_file pathname, -of pathname forces the output to be placed in the file defined by pathname. -stop_after pass, -spaf pass specifies to cc to stop after the specified pass of the compiler. Valid values for pass are: preprocessor, pp -generates a ".cpp" file which is the output from the preprocessor. c -generates a ".alm" file which is the alm source file output from the C compiler. alm -generates a ".cob" file which is the intermediate executable file generated from the assembler. This file is to be used as input to the linkage editor. 3. The C Execution Environment The usual computer upon which C runs has the typical 'load and go' style of operating system. Multics does not normally use a loader, and this causes some problems with what a software package expects to happen during certain operations. Please examine the following MTBs for a complete explanation: MTB 691, Execution Environment, by Doug Howe (for information on main_). MTB 732, Hardcore Changes, by Doug Howe (for information on the heap manager). MTB-761-00 Multics C Overview 4. The C Runtime Library The C runtime library consists of a group of subroutines selected from those available on System V Unix, which have some meaning on Multics and do not conflict too badly with what already exists. For further information, please read MTB 689, Runtime MTB, by Doug Howe. 5. Hard Core Some of the features of 'standard C' cannot be realized with standard Multics. It was felt from the beginning that it was necessary to provide a 'standard' environment, so Multics was extended. The extensions are detailed in MTB 732, Hardcore Changes, and MTB 738, List Init Changes, both by Doug Howe. 6. The Linkage Editor Most operating systems require the use of a 'linkage editor' to resolve external references. This is not true of Multics. This difference causes some problems with compatibility. Some of these problems are discussed in the following MTBs: MTB 711, Very Large Objects, by Dean Elhard MTB 718, Linkage Editor, by Dean Elhard 7. ALM Some changes were required in ALM for C support. These changes are documented in MTB 734, ALM (simple changes), by Rick Gray.