For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > June 2005 > over-ride System.dynlib malloc() in Darwin









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author over-ride System.dynlib malloc() in Darwin
Damien Cooke

2005-06-07, 4:02 pm

Anyone done this? I can not seem to be able to tell the linker not to
worry about the duplicate symbols. Unless I use nothing from the stdlib
in the library I am writing I seem unable to bolt in another allocator.

Any assistace appreciated

Damien
Måns Rullgård

2005-06-07, 4:02 pm

Damien Cooke <damien.cooke@internode.on.net> writes:

> Anyone done this? I can not seem to be able to tell the linker not to
> worry about the duplicate symbols. Unless I use nothing from the
> stdlib in the library I am writing I seem unable to bolt in another
> allocator.


How are you linking your malloc implementation with the code that uses
it? What are the error messages? What OS are you using?

--
Måns Rullgård
mru@inprovide.com
Damien Cooke

2005-06-08, 4:00 am

I am linking like this:

cc -dynamiclib -fPIC -o bin/liblpmalloc.so output/lpmalloc.o output/global.o

But I now get:

ld: warning multiple definitions of symbol _malloc
output/lpmalloc.o definition of _malloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libSystem.dylib(malloc.So)
definition of _malloc

So how do I tell it I am building a replacement for malloc other than
re-implementing the System.dylib ? Is there a way of dropping duplicate
entries? I can link without libSystem.dylib but that means I can not
use printf etc.....

Damien

Måns Rullgård wrote:
> Damien Cooke <damien.cooke@internode.on.net> writes:
>
>
>
>
> How are you linking your malloc implementation with the code that uses
> it? What are the error messages? What OS are you using?
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com