SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
C/C++ Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
15-9
Preprocessor Functions
Preprocessor Functions
The preprocessor processes C/C++ and SQL source statements.
C/C++ Source Statements
The preprocessor writes each C/C++ source statement to the C/C++ annotated source
file. The preprocessor parses the source file only to the extent necessary to detect
scoping levels, host variable declarations, host variable expressions, and embedded
SQL statements.
C Preprocessing Directives
The preprocessor ignores C directives except the #include, #define, #line, or
conditional compilation directives.
C #include Directive
The preprocessor expands first-level #include files. A comment is inserted in the
output source in the place of the original #include line, followed by the #include file
contents.
The preprocessor processes only #include files that have a.mxh extension or, with
the -h command line option specified, a.h extension.
The preprocessor ignores:
•
Nested #include directives
•
System #include directives (for example, <time.h>)
•
The NOLIST option if it is part of the #include file command
Examples:
•
The contents of the mine3.mxh file are included in the output source file:
#include "mine3.mxh"
•
Only sect1, sect2,and sect6 are included, and NOLIST is ignored:
#include "mine4.mxh (sect1,sect2,sect6)" NOLIST
•
The contents of the .h files are included if -h is specified, and NOLIST is ignored:
#include "mine.h"
#include "../includes/mine2.h" NOLIST
•
System directives, such as <time.h>, are never included:
#include <time.h>
As with any #include file inclusion, you must ensure that implementation of
conditional compilation does not result in repeated file inclusion.