Windows CLI routine compile and link options
The compile and link options in this topic are recommended by Db2 for building
CLI routines
with the Microsoft Visual C++ compiler. They are
demonstrated in the sqllib\samples\cli\bldrtn.bat batch file.
Compile options:
%BLDCOMP%- Variable for the compiler. The default is
cl, the Microsoft Visual C++ compiler. It can be also set toicl, the Intel C++ Compiler for 32-bit and 64-bit applications, orecl, the Intel C++ Compiler for Itanium 64-bit applications. -Zi- Enable debugging information
-Od- Disable optimizations. It is easier to use a debugger with optimization off.
-c- Perform compile only; no link. The batch file has separate compile and link steps.
-W2- Set warning level.
-DWIN32- Compiler option necessary for Windows operating systems.
-MD- Link using MSVCRT.LIB
Link options:
link- Use the 32-bit linker.
-debug- Include debugging information.
-out:%1.dll- Build a .DLL file.
%1.obj- Include the object file.
utilcli.obj- Include the utility object file for error-checking.
db2api.lib- Link with the Db2 API library.
-def:%1.def- Use the module definition file.
/delayload:db2app.dll- Used to ensure that db2app.dll is not loaded until the first call to a Db2 API. This is required when using the db2SelectDB2Copy API.
db2ApiInstall.lib- Library to statically link in your application if you need to select a particular Db2 copy that is
installed on the computer using the db2SelectDB2Copy API. Note: to use this
functionality, you need to either dynamically load db2app.dll or use the
/delayload:db2app.dlloption of your compiler and call the db2SelectDB2Copy API before running any other Db2 API's.
Refer to your compiler documentation for additional compiler options.