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 COBOL523627-004
15-40
c89 Examples With Embedded Module Definitions
This command preprocesses, compiles, links, and SQL compiles a single C source
file named sqlprog.ec:
c89 -Wsqlmx -Wmxcmp -o sqlprog.exe sqlprog.ec
The c89 utility invokes the preprocessor, mxsqlc, which uses the file
sqlprog.ec as input and produces one file, sqlprog.c, which is a C annotated
source file that contains embedded module definitions. The c89 utility then
compiles and links sqlprog.c to produce the executable file, sqlprog.exe. The
SQL/MX compiler command -mxcmp processes the executable file with the
SQL/MX compiler, mxCompileUserModule, to produce the module.
This command preprocesses several C++ source files and compiles them, but it
does not link the results:
c89 -c -Wsqlmx file1.eC file2.ecc file3.ec++
If no errors are detected in either the preprocessing or compiling steps, these files
are created: file1.C, file2.cc, file3.c++, file1.o, file2.o, and
file3.o. TNS/E compilation also produces these files: file1.dep, file2.dep,
and file3.dep.
To compile the preprocessed source file named sqlprog.cpp without linking:
c89 -I /usr/tandem/sqlmx/include -c sqlprog.cpp \
-o sqlprog.exe
The -I option indicates the path for the Platform.h file.
If you have multiple source files, you must compile each source file before linking
them. For example, this c89 command compiles the preprocessed source files
named sqlprog1.c and sqlprog2.c and links them to create an executable file
named sqlprog.exe:
c89 -I /usr/tandem/sqlmx/include sqlprog1.c sqlprog2.c \
-o sqlprog.exe
The c89 utility provides commands that pass through options to the SQL/MX
preprocessor and the SQL/MX compiler (-Wsqlmxadd and -Wmxcmp_add,
respectively). To preprocess files with preprocessor options, use the -Wsqlmxadd
option:
-Wsqlmxadd=-a
To pass a single option, do not use quotes or white space characters. To pass
multiple options, place them within double quotes and separate the options with a
white-space character:
-Wsqlmxadd="-a -p -m -c test.c"
If you did not link your object files using the c89 utility, create the executable
program by using the native object file linker to link one or more object files. For