TotalView Reference Guide : Part I: CLI Commands : Creating Type Transformations : C++View : Compiling and linking tv_data_display.c

Compiling and linking tv_data_display.c
Your distribution includes the file tv_data_display.c. in the <totalview-installation>/src directory. This file contains the implementation of the interface between your TV_ttf_display_type functions and TotalView. This is distributed as source. You will need to compile this file and link it with your application.
You should take care to ensure that there is only one instance of tv_data_display.c present in your running application. One way in which multiple instances could creep in is if you link separate copies of the tv_data_display.c into independent shared libraries that your program uses. To avoid this type of problem, we strongly suggest that you build tv_data_display.c into its own separate shared library that can be shared by all the libraries your application uses. For example:
setenv TVSOURCE /usr/local/toolworks/totalview.8.9.0-2/src
setenv TVINCLUDE /usr/local/toolworks/totalview.8.9.0-2/include
 
gcc -g -Wall -fPIC -c $TVSOURCE/tv_data_display.c -I$TVINCLUDE gcc -g \
-shared -Wl,-soname,libtv_data_display.so -o libtv_data_display.so tv_data_display.o
Some compilers or linkers will perform a type of garbage collection step and eliminate code or data that your application does not use. This affects C++View in two ways:
1
Your TV_ttf_display_type functions are unlikely to be called by your program.
2
Leading on from this, some of the entities in tv_data_display.c may not be reachable from your program.
As a result, the compiler or linker may identify your TV_ttf_display_type or tv_data_display.c as candidates for garbage collection and elimination. You can try to work around this problem by trying to create references to the TV_ttf_display_type functions.
Better still, we suggest identifying the flags for your compiler or linker that disable garbage collection. On AIX, for example, the linker flag -bkeepfile:<filename> tells the linker not to perform garbage collection in the file named <filename>.

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