Linking with nonstandard malloc
Amittai Aviram
amittai.aviram@yale.edu
Tue Jan 4 21:34:00 GMT 2011
On Jan 4, 2011, at 4:30 PM, Brian Budge wrote:
> On Tue, Jan 4, 2011 at 1:14 PM, Amittai Aviram <amittai.aviram@yale.edu> wrote:
>> Suppose I want to use my own malloc.c and malloc.h for malloc and related functions (based on Doug Lea's code), but use the standard C library (glibc) for all other C library functions. Is there a way that I can tell the gcc linker to use my malloc code but glibc for everything else? Thanks!
>>
>> Amittai Aviram
>> PhD Student in Computer Science
>> Yale University
>> 646 483 2639
>> amittai.aviram@yale.edu
>> http://www.amittai.com
>>
>>
>
> Have you tried just linking it in? I believe it should just work.
>
> Brian
Alas, not so far. In order to check, I put the following line at the start of dlmalloc in malloc.c:
write(1, "HIT\n", 5);
but I didn't see this message on my console when I called malloc. :-( (I believe the the file #defines dlmalloc as malloc in the default case.)
Amittai Aviram
PhD Student in Computer Science
Yale University
646 483 2639
amittai.aviram@yale.edu
http://www.amittai.com
More information about the Gcc-help
mailing list