How to tell compiler to use my_malloc inplace of normal 'malloc'

Mirko Vogel mirko.vogel@gmx.de
Thu Aug 23 08:04:00 GMT 2001


Hello,

why don't you compile the files you want to use my_alloc
with -Dmalloc=my_malloc and the rest without:

gcc -c file1.c file2.c -Dmalloc=my_malloc
gcc -c my_alloc.c
gcc file1.o file2.o my_alloc.o

You said, you just want to replace the malloc-*calls*, so I assume, the
string "alloc" appears otherwise, too. Perhaps -Dmalloc(=my_malloc( will
work?

But thats a really ugly solution...

Mirko Vogel





More information about the Gcc-help mailing list