Linking C & extern(C) on OS X: duplicate symbols not flagged

"Luís "Luís
Tue Sep 3 15:36:41 PDT 2013


On Saturday, 31 August 2013 at 11:16:11 UTC, Jacob Carlborg wrote:
> So DMD and Clang uses different sections? Have you tried GDC or 
> LDC?

Sorry for the delay.

Using LDC fails, as expected / desired:

     duplicate symbol _dotest in:
         d/test.o
         c/test.o
     ld: 1 duplicate symbol for architecture x86_64

The LDC .o sections are the same as the C version:

     $ nm d/test.o | grep dotest; echo "--"; nm c/test.o | grep 
dotest
     0000000000000000 T _dotest
     00000000000000b0 S _dotest.eh
     --
     0000000000000000 T _dotest
     0000000000000060 S _dotest.eh

I haven't tried GDC (I get the object.d not found error, even 
after installing the D .dmg package, instead of using brew, and I 
don't recall how I used to solve that), but I imagine it would 
also fail-work (detect the duplicate symbol, and fail 
compilation).


More information about the Digitalmars-d mailing list