This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Linking with nonstandard malloc
- From: Mihai DonÈu <mihai dot dontu at gmail dot com>
- To: Amittai Aviram <amittai dot aviram at yale dot edu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 4 Jan 2011 23:31:13 +0200
- Subject: Re: Linking with nonstandard malloc
- References: <6E5F7495-3338-4F05-B635-AAEA3226F9C8@yale.edu>
On Tuesday 04 January 2011 23:14:21 Amittai Aviram 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?
$ gcc -o myapp myapp.o malloc.o
The static linker will choose the symbols from the object files passed in the
command line, over the ones from any dynamic library.
(tested on Linux)
--
Mihai DonÈu