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

Jacob Carlborg doob at me.com
Tue Mar 6 02:31:40 PST 2012


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.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list