User Tools

Site Tools


ibm:vm370-lib:cmshelp:gcc.helpcmd

GCC

CMS Commands

gcc.helpcmd.txt
GCC                                                                    CMS EXEC

Use the GCC command to compile and assemble a C source file using the GNU C
compiler.  Then use the LOAD and START commands to run the program:
   gcc hello
   load hello
   start
The format of the GCC command is:
+----------+------------------------------------------------------------------+
| GCC      | [fn [ft|C [fm|A]]] [( [options]                                  |
|          | options:                                                         |
|          |    ASM|NOASM     CSECT|NOCSECT     KEEP|NOKEEP     LIB fn        |
|          |    OS|CMS        PARM fn                                         |
+----------+------------------------------------------------------------------+
where:

fn [ft [fm]]
         identifies the C source file to be compiled.  ft defaults to C and fm
         defaults to A.

Options:

ASM|NOASM
         specifies whether the ASSEMBLE output file from the C compiler is to
         be assembled or not.  ASM is the default.

CSECT|NOCSECT
         specifies that the blank CSECT statement produced by GCC is to be
         given a label. NOCSECT is the default.  CSECT is required only when
         building a library of C routines.

KEEP|NOKEEP
         specifies whether or not the assembler output files from the C
         compiler are to be kept or erased.  NOKEEP is the default.

LIB fn   specifies the runtime library with which the program is to be
         compiled.  GCC will link and access the appropriate disk containing
         the C header files.  Two runtime libraries are available:

         GCCLIB  uses only "native" CMS functions for system services.  Using
                 this library it is possible to write programs that may be
                 loaded into resident memory as extensions of the CMS nucleus.
                 For example, you can open CMS files directly by name.

                 Ensure GCCLIB is in your list of GLOBAL TXTLIBs to run your
                 compiled progam.  Type HELP GCCLIB for more information.

         PDPCLIB uses simulated OS functions for system services, just like
                 FORTRAN or PL/I.  For example, you must use the FILEDEF
                 command to identify CMS files to your program.

                 Ensure PDPCLIB is in your list of GLOBAL TXTLIBs to run your
                 compiled progam.

         LIB PDPCLIB is the default.

OS|CMS   OS is shorthand for LIB PDPCLIB.  CMS is shorthand for LIB GCCLIB.

PARM fn  specifies a file of type PARM containg arguments to pass to GCC.  By
         default 'GCC PARM *' is used.


Usage Notes:

1.  To compile a C program called HELLO C A, type
       GCC HELLO
    To run the program, you must have the appropriate TXTLIB specified.  Use
    the GLOBAL command to do this:
       GLOBAL TXTLIB PDPCLIB
    Now you can load and run the program:
       LOAD HELLO
       START
    Alternatively you can create a module of your program:
       LOAD HELLO
       GENMOD HELLO
    Now you can invoke the program by typing its name:
       HELLO

2.  If your program does any I/O you must use the FILEDEF command to define
    those files to your program.  Then in the program refer to the ddname you
    specified on the FILEDEF command.  For example, if in your C program you
    code:
       fopen("DD:TEST", "w");
    You would need to issue this FILEDEF command before running the program:
       FILEDEF TEST DISK TEST DATA A (LRECL 80 RECFM V

3.  The source code for the GCC compiler and runtime libraries is on the
    GCCCMS userid disks.

4.  An alternate runtime library called GCCLIB is available for C programs.
    This runtime library lets you code C programs that directly access CMS
    system services.  Type HELP GCCLIB for more information.
ibm/vm370-lib/cmshelp/gcc.helpcmd.txt ยท Last modified: 2023/08/06 13:36 by Site Administrator