Debian Codegraph @

contrib/dec_notes

raw
1 -------------------------------------------------------------------------------
2 $Id: dec_notes,v 1.7 2000/03/21 20:13:02 gray Exp $
3 -------------------------------------------------------------------------------
4
5 From Dave Hill:
6 -----------------------------------
7
8 DEC OSF1/AXP extra notes:
9 =========================
10
11 To build this library, you will need to have -std1 as a flag to cc in
12 the Makefile. This sets the compiler into ansi-mode. The configure
13 script may have done this for you, but if not, the Makefile should
14 read:
15
16 # default c-compiler
17 CC = cc -std1
18
19 To create a shared library from the static library:
20
21 ld -shared -o libdmalloc.so -all libdmalloc.a -all \
22 -soname libdmalloc.so -none -lc
23
24 The OSF1/AXP shared library loader has the capabilities to override the
25 shared libraries used, even to the extent that it takes symbols from a
26 library that the program was not linked with. Using this technique, you
27 may override the standard malloc in libc with the debug malloc shared
28 library.
29
30 _RLD_LIST=/path_to_the_dir/libdmalloc.so:DEFAULT;export _RLD_LIST
31
32 Remember though, setting this variable will affect ALL commands invoked
33 from the shell that it is set inside of. You may wish to do this inside
34 of a shell script that sets the variable just before starting your
35 program. Another option with sh and ksh is to list the environment
36 variables on the program invocation line, for example:
37
38 _RLD_LIST=/path_to_the_dir/libdmalloc.so:DEFAULT program
39
40 This command will set the specified env variable and then run program.
41
42 -------------------------------------------------------------------------------
43
44 [The dmalloc library currently supports the at_exit() auto-shutdown
45 routine. If this is not working, however, you may want to consider
46 the following.]
47
48 OSF1 also supports the use of an 'init' and a 'fini' routine. Any function
49 prefixed with '__init_' will be executed prior to main() and any function
50 prefixed with '__fini_' will be executed after any call to exit() or
51 after main() returns.
52
53 A fini routine can be used with the debug library to invoke dmalloc_shutdown
54 to get final statistics from the library package. For example:
55
56 void
57 __fini_dmalloc()
58 {
59 dmalloc_shutdown();
60 }
61
62 Try putting this code in a separate .o file and linking it into your
63 application when you are debugging.