TotalView Reference Guide : Part III: Platforms and Operating Systems : Platforms and Compilers : Linking with the dbfork Library : dbfork on IBM AIX on RS/6000 Systems

dbfork on IBM AIX on RS/6000 Systems
Add either the -ldbfork or -ldbfork_64 argument to the command that you use to link your programs. If you are compiling 32-bit code, use the following arguments:
*
*
For example:
cc -o program program.c \
-L/usr/totalview/rs6000/lib/ -ldbfork \
-bkeepfile:/usr/totalview/rs6000/lib/libdbfork.a
If you are compiling 64-bit code, use the following arguments:
*
*
For example:
cc -o program program.c \
-L/usr/totalview/rs6000/lib -ldbfork \
-bkeepfile:/usr/totalview/rs6000/lib/libdbfork.a
When you use gcc or g++, use the -Wl,-bkeepfile option instead of using the -bkeepfile option, which will pass the same option to the binder. For example:
gcc -o program program.c \
-L/usr/totalview/rs6000/lib -ldbfork -Wl, \
-bkeepfile:/usr/totalview/rs6000/lib/libdbfork.a
Linking C++ Programs with dbfork
You cannot use the -bkeepfile binder option with the IBM xlC C++ compiler. The compiler passes all binder options to an additional pass called munch, which will not handle the -bkeepfile option.
To work around this problem, we have provided the C++ header file libdbfork.h. You must include this file somewhere in your C++ program. This forces the components of the dbfork library to be kept in your executable. The file libdbfork.h is included only with the RS/6000 version of TotalView. This means that if you are creating a program that will run on more than one platform, you should place the include within an #ifdef statement’s range. For example:
#ifdef _AIX
#include "/usr/totalview/include/libdbfork.h"
#endif
int main (int argc, char *argv[])
{
}
In this case, you would not use the -bkeepfile option and would instead link your program using one of the following options:
*
*

Rogue Wave Software, Inc.
Voice: (303) 473-9118
support@roguewave.com