duplicate symbol linker errors, my fault or D's?

Jacob Carlborg doob at me.com
Tue Mar 6 23:49:36 PST 2012


On 2012-03-07 01:47, Jonathan M Davis wrote:
> On Tuesday, March 06, 2012 11:31:40 Jacob Carlborg wrote:
>> On 2012-03-06 08:56, Jonathan M Davis wrote:
>>> On Tuesday, March 06, 2012 08:29:53 Jacob Carlborg wrote:
>>>> On 2012-03-06 02:21, Jonathan M Davis wrote:
>>>>> On Tuesday, March 06, 2012 01:53:02 Zach the Mystic wrote:
>>>>>> Reading the documentation about compiler options and flags here:
>>>>>> http://dlang.org/dmd-osx.html
>>>>>>
>>>>>> led me to believe that building libraries was the right way to do
>>>>>> incremental compilation. But I thought, well, can I just build
>>>>>> file1.o object files instead?
>>>>>>
>>>>>> So I've started doing that and I've got no problems so far. I
>>>>>> guess I don't need all that fancy .lib and -L-lmyLib stuff after
>>>>>> all. You can pack all sorts of stuff into a file1.o file instead.
>>>>>>
>>>>>> I guess I solved my problem for now. Hopefully I'm making sense.
>>>>>
>>>>> Libraries are not intented for incremental compilation. They are for
>>>>> distributing code in a unit which can be used by programs. And in the
>>>>> case
>>>>> of a shared library, it gives the added benefit of reducing the amount
>>>>> of
>>>>> duplicate code you get in binaries (saving both memory and disk space).
>>>>>
>>>>> If you want to do incremental compilation, then use -c to generate
>>>>> object
>>>>> files that you link together when you create the actual executable.
>>>>>
>>>>> - Jonathan M Davis
>>>>
>>>> Actually the -lib switch might be the answer to one of the incremental
>>>> compilation problems DMD suffers from. That DMD usually does not output
>>>> all symbols to all object files which can result in missing symbols when
>>>> doing incremental compilation. I've heard that the when using the -lib
>>>> flag DMD will output all symbols to all object files.
>>>
>>> If so, it's an implementation issue. In principle, libraries have nothing
>>> to do with incremental compilation. They're about modularizing code for
>>> reusability.
>>>
>>> - Jonathan M Davis
>>
>> Yes, but Walter doesn't seem to want to fix that issue.
>
> Well, from the sounds of it, he's going to need to be convinced one way or
> another - which can be frustratingly difficult at times. Sometimes, he's right
> even when pretty much no one agrees with him, but other times, he just doesn't
> seem to get it. He's hard to convince in either case though.
>
> - Jonathan M Davis

If I recall correctly, he mentioned some issues with COMDAT. Here is the 
full discussion:

http://www.digitalmars.com/d/archives/digitalmars/D/Incremental_compilation_with_DMD_96138.html

Mentions something about COMDAT: 
http://www.digitalmars.com/d/archives/digitalmars/D/Incremental_compilation_with_DMD_96138.html#N96197

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list