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-47
Quick Builds and mxcmp Defaults in a One-File
Application Deployment
Because no module specification strings were specified at the command line, 
mxsqlc generates code using the module name ‘cat.sch.sqlappmod.’ The 
SQL/MX object naming rules for default catalog and schema apply to an 
unqualified module directive, in addition to other unqualified names of tables, 
views, and other SQL objects. 
3. Run the C/C++ compiler on sqlapp.cpp:
c89 -Wversion2 -I/usr/tandem/sqlmx/include -c sqlapp.cpp 
4. Run the native linker on sqlapp.o and sqlutil.o to create the sqlapp.exe 
executable file. For TNS/R native applications, use the nld utility:
nld -elf -set systype oss -set highpin off\
-set highrequestor on -set inspect on \
-obey /usr/lib/libc.obey -set saveabend on \
/usr/lib/crtlmain.o sqlapp.o sqlutil.o \
-lzcplsrl -lzcrtlsrl -lzcresrl -lzcplosrl -lztlhgsrl \
-lztlhosrl -Bdynamic -lzclisrl -o sqlapp.exe 
5. Run the SQL/MX compiler after setting up class MAP DEFINEs:
add_define =midcaps class=map \
 file=\\pecan.\$data07.holding.midcaps 
mxCompileUserModule -v -d AUTOMATIC_RECOMPILATION=ON \
 -d RECOMPILATION_WARNINGS=ON -d SIMILARITY_CHECK=ON \
 sqlapp.exe 
This command compiles the application’s module ‘cat.sch.sqlappmod.’ 
Assuming that the sqlutil.o’s compiled module is still current, you can now run 
sqlapp.exe. 
Quick Builds and mxcmp Defaults in a One-File Application 
Deployment 
Suppose that you are actively developing, testing, and debugging a new SQL/MX 
Release 2.x application that you have organized into three separate static SQL C/C++ 
source files. You can minimize unnecessary SQL recompilations during active 
development and still retain the simplicity of building and deploying self-contained 
application files by using the named module option of the SQL/MX compiler. 
The next example uses mxcmp command-line defaults to module compile an 
application executable to work with one set of tables on the development system and 
later module compile the same application executable to work with a different set of 
tables on the production system. 
In addition, this example shows that references to module names are always resolved 
early at preprocessing time. It also shows that the resolution of references to other 
SQL objects (tables, views, and so on) can be deferred to as late as module 
compilation time. 










