[comp.sys.amiga] How to Use Pre-Compiled Headers

rlcarr@athena.mit.edu (Rich Carreiro) (03/22/89)

I've finally gotten the definitive word on how to use Pre-Compiled header
files in Lattice C 5.02.  This is straight from the Amiga message base on the
LBBS. 

Message #417
  To ALL                                    01-20-89            
From CARLOTTA DECONCILIS (SYSOP)            Subject PRECOMPILED HEADERS
---------------------------------------------------------------------------
HOW TO USE PRECOMPILED HEADER FILES:

Precompiled header files can be generated with the 5.0 version
of Lattice C for the Amiga.  Precompiled header files allow
for faster compilation than compressed or ASCII headers on
subsequent compilations, however they are larger.

To generate a precompiled header file do the following:

        1)  Create a trivial C program that pulls in the header
            files that you wish to precompile.  For example to
            precompile stdio.h write a program called foo.c with
            the single line:

            #include "stdio.h"

        2)  Next, invoke lc with the following line:

            lc -ph -ostdio.sym foo.c

            Any file name will work.  The ".sym" extension is not
            special but some consistent naming convention will help
            you recognize precompiled header files when you encounter
            them.

        3)  To use the precompiled version of the header, use the -H
            option on the lc command line.  There is no limit to the
            number of times -H may be specified on the command line.
            For example:

            lc -Hstdio.sym -Hstdlib.sym bar.c

            If you plan to include debug information in the object
            module, for data types specified in the header file, you
            must include the -d option before the -H option.  If you
            put the -d option after the -H option, no structure members
            or data types defined in the header will be available to
            the debugger.

Note that any data declared in a precompiled header file is assumed
to be extern.  Therefore, the object must be declared in one of the c
modules to be linked into the executable file.

** Use the "-h" (lower case) option instead of "-H" in v5.0.
V5.02 of Lattice C will support the upper case "-H" option.
Both, accomplish the same thing.

================================

Enjoy!

ARPA:    rlcarr@athena.mit.edu
UUCP:    ...!mit-eddie!mit-athena!rlcarr
BITNET:  rlcarr%athena.mit.edu@MITVMA.mit.edu

*******************************************************************************
* Rich Carreiro                 "Back off man, I'm a scientist."              *
* rlcarr@athena.mit.edu                - Dr. Peter Venkman                    *
*******************************************************************************