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

Jonathan M Davis jmdavisProg at gmx.com
Mon Mar 5 23:56:18 PST 2012


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


More information about the Digitalmars-d-learn mailing list