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-42
c89 Examples With Module Definition Files
•
This command preprocesses, compiles, links, and SQL compiles a single C source 
file named sqlprog.ec:
c89 -Wsqlmx -Wsqlmxadd=-x -Wmxcmp -o sqlprog.exe \
sqlprog.ec sqlprog.m
The c89 utility invokes the preprocessor, mxsqlc, which uses the file 
sqlprog.ec as input and produces two files: sqlprog.c and sqlprog.m. The 
file sqlprog.c is the C annotated source file, and the file sqlprog.m is the 
corresponding module definition file. The c89 utility then compiles and links 
sqlprog.c to produce the executable file, sqlprog.exe. The SQL/MX compiler 
command -Wmxcmp processes the module definition file sqlprog.m with the 
SQL/MX compiler, mxcmp, to produce the module.
•
This command preprocesses several C++ source files and compiles them, but it 
does not link the results:
c89 -c -Wsqlmx -Wsqlmxadd=-x file1.eC file2.ecc file3.ec++
If no errors are detected in either the preprocessing or compiling steps, these files 
are created: file1.m, file1.C, file2.m, file2.cc, file3.m, 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
•
If you did not link your object files by using the c89 utility, create the executable 
program by using the native object file linker to link one or more object files. For 
example, this nld command links sqlprog1.o and sqlprog2.o to create an 
executable file named sqlprog.exe:
nld sqlprog1.o sqlprog2.o -o sqlprog.exe
For more information on nld, see the nld Manual.










