std library hooks

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Sat Apr 14 22:08:35 PDT 2012


"Walter Bright" <newshound2 at digitalmars.com> wrote in message 
news:jmdhof$1v3v$1 at digitalmars.com...
> On 4/14/2012 4:54 PM, Manu wrote:
>> I just tried it, and I got the error I expected:
>>
>> LIBCMTD.lib(atox.obj) : error LNK2005: _atoi already defined in Unit.obj
>>
>> In C, I would always explicitly declare weak linkage to do this... what's 
>> the
>> point of the weak attribute if not for this?
>
> First you need to find out why you have multiple definitions of the same 
> symbol being linked together. For example, do not specify libcmtd.lib to 
> the linker, then link, then see what your unresolved symbols are.

This contradicts what you said earlier about symbols in obj files always 
overriding ones in lib files. Either obj symbols override lib symbols or 
they conflict. Manu demonstrated that they conflict, rather than override. 
How is your suggestion for replacing druntime functions supposed to work 
when the linker is just going to bitch about them being "already defined"?




More information about the Digitalmars-d mailing list