Choose Your Run-Time Library (OS/2, Windows)

You must link most C and C++ programs with the VisualAge C++ run-time library. This library contains all C functions specified in the C standard, and many additional C functions. You can call run-time library functions from C and C++ programs.

Choose your run-time library according to your answer to the following questions:

By default, the singlethread static runtime library is linked. This minimizes the overhead required to support features you may not need. To override the default, specify the one or more of the following options in your configuration file:

option purpose
link(linkWithMultiThreadLib[, yes])
link(linkWithMultiThreadLib, no)
support multithreading
link(linkWithSharedLib[, yes])
link(linkWithSharedLib, no)
link dynamically
link(standAlone[, yes])
link(standAlone, no)
build a subsystem
link(defaultLibs[, yes])
link(defaultLibs, no)
link with no default run-runtime library

Generally, you should ensure that all modules used by your application link to the same run-time environment. Otherwise your program may not build correctly or may have unpredictable behavior at run time.

link(linkWithMultiThreadLib)
Use link(linkWithMultiThreadLib) if you use the IBM Open Class Library or your application launches more than one thread. This library ensures that only one thread is active at a time in parts of a function where there might otherwise be contention for resources.

link(linkWithSharedLib)
Use link(linkWithSharedLib) when you do not want the code for run-time functions to be copied into the module you are building. Instead, only a stub from an import library is embedded in your module and the functions are dynamically linked at load time. This reduces the size of your module, and lets several modules share one copy of the run-time function. For the program to execute, the VisualAge C++ run-time DLL must be available on the target machine.

When you are building your own DLL, it is common to dynamically link to the run-time library. You can statically link your DLL with the run-time library, but doing so can cause problems if applications that use your DLL acquire more than one run-time environment as a result.

link(standAlone)
Use link(standAlone) if you are building a module designed to run without a run-time environment.

Functions in the subsystem libraries do not support multithread applications. However, you can use the subsystem libraries in multithread programs if you provide your own protection and serialization using semaphores. You must also provide your own buffering for input and output.

link(defaultLibs, no)
You can build with link(nodefaultlibs, no) to output a module that does not link to any version of run-time library. If you do that, all developers who link with your module should also specify link(nodefaultlibs, no) and explicitly name a version of the run-time library in the source directive.



Static and Dynamic Link Libraries
Configuration Files
Multithreaded Programs

Run-Time Environments
Introduction to the Open Class Library


Set Build Options
Build
Build Dynamic Link Libraries
Build Subsystems


Link Options
Run-Time Library File Names