[tools-linking] Question about: dynamic functions in a.out

2009-02-23 Thread Ginn Chen
I have two programs, malloc.c and main.c. I have malloc/free functions in malloc.c, and main in main.c. If I compile malloc.c to a shared object, and main.c to a.out, then I can override the malloc function at runtime by using LD_PRELOAD = libc or libumem, etc. If I compile and link both mall

[tools-linking] Question about: dynamic functions in a.out

2009-02-23 Thread Ali Bahrami
Ali Bahrami wrote: > If you link your own malloc into your a.out, then your > malloc will be the one used. Are you asking if you will > then be able to override this using LD_PRELOAD? > > If that's what you're asking, then the answer is yes, as long > as your malloc() is global, and you didn't use

[tools-linking] Question about: dynamic functions in a.out

2009-02-23 Thread Ali Bahrami
Ginn Chen wrote: > I have two programs, malloc.c and main.c. > I have malloc/free functions in malloc.c, and main in main.c. > > If I compile malloc.c to a shared object, and main.c to a.out, then I > can override the malloc function at runtime by using LD_PRELOAD = libc > or libumem, etc. > >