Dependency management in D

Scott Wilson via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 19 10:34:10 PDT 2014


On Friday, 19 September 2014 at 05:27:33 UTC, Vladimir Panteleev 
wrote:
> On Friday, 19 September 2014 at 05:19:07 UTC, Walter Bright 
> wrote:
>> On 9/18/2014 9:56 AM, Vladimir Panteleev wrote:
>>> On Thursday, 18 September 2014 at 16:48:22 UTC, Scott Wilson 
>>> wrote:
>>>> Unit of compilation is one D file but I saw if I pass 
>>>> several D
>>>> files to the compiler only one .o file is generated. Whats 
>>>> the
>>>> story there.
>>>
>>> DMD will generate one object file per module file, unless you 
>>> use the -of
>>> option.
>>
>> This is incorrect. It'll generate one object file per 
>> invocation of dmd.
>
> Erm, that's not quite correct either. I meant, one object file 
> per module file passed on the command line.

I tried this

dmd test.d test2.d

Got one test.o and one binary test. No test2.o. Must be that 
thing where all modules compiled are smashed. The first filename 
dictates the .o name. Correct?

Also tried

dmd -c test.d test2.d

In that case yes both .o are generated.

So the trick with all this is how to opt between building all and 
building each incrementally. Any tools helping with that? For 
example tool that shows dependencies. If some files are dependent 
on each other they better be compiled together anyway.


Scott


More information about the Digitalmars-d mailing list