This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to tell compiler to use my_malloc inplace of normal 'malloc'
- To: <gcc-help at gcc dot gnu dot org>
- Subject: Re: How to tell compiler to use my_malloc inplace of normal 'malloc'
- From: "John Love-Jensen" <eljay at adobe dot com>
- Date: Thu, 23 Aug 2001 10:19:37 -0500
- References: <018401c12be4$c4a3ede0$37fe0280@is.cs.cmu.edu>
Just define your malloc function as "malloc", with the exact same C
signature. Your .o will preferential link in lieu of the libc.so malloc or
lib.a malloc.
extern "C" void* malloc(size_t size);
// My malloc.
void* malloc(size_t size)
{
// ...my own heap management routines using sbrk and such...
}
--Eljay