From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Oliva To: "Mynampati, Venkata S." Cc: "'gcc-help@gcc.gnu.org'" Subject: Re: How to tell compiler to use my_malloc inplace of normal 'malloc' Date: Thu, 23 Aug 2001 23:39:00 -0000 Message-id: References: X-SW-Source: 2001-08/msg00215.html On Aug 22, 2001, "Mynampati, Venkata S." wrote: > I read that while compiling i can tell the compiler to replace all mallocs > with my wrapper function called 'my_malloc', in which, i do something > and call malloc. You can do this if you're using the GNU linker: it accepts -wrap=malloc, so you define _wrap_malloc and call _real_malloc() in it whenever you mean to call the actual malloc. Of course, you only use this at link time. -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{cygnus.com, redhat.com} CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist *Please* write to mailing lists, not to me