March 11, 2013
On 3/11/13 8:34 AM, Timon Gehr wrote:
> On 03/11/2013 07:51 AM, Rainer Schuetze wrote:
>> An import is listed in the module info struct as a dependency, if it has
>> static constructors (or destructors) or if it imports modules that have
>> static constructors.
>> If a di-file misses an import, it might not end up
>> in the imported modules list of an importing module, so the correct
>> order cannot be determined at runtime.
>> ( Search the dmd source for "needmoduleinfo", especially
>> https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L150
>>
>> and
>> https://github.com/D-Programming-Language/dmd/blob/master/src/import.c#L344
>>
>> )
>>
>> Also, you might run into trouble when removing static
>> constructors/destructors from the di-file because of this.
>>
>
> I see, thanks! IMO this is ridiculous. I'd argue it is an implementation
> bug and should be fixed.

Rainer, could you please file this to bugzilla?

Thanks,

Andrei
March 11, 2013
> The better option would be to pass all source files to update in one invocation of dmd, so it won't get slower than a full rebuild, but this has been plagued with linker errors in the past (undefined and duplicate symbols). If it works, it could identify independent group of files which you now separate into libraries.

Aside from linker errors, there is one more (minor) issue with this approach. If there are multiple source files with the same name and there is no -of flag, DMD will generate an object file for just one of them. This could be worked around in rdmd by symlinking or copying files, but I think it would be better to fix it in DMD and use module.name.o instead of source_file_name.o for object file names.
March 11, 2013
On Monday, 11 March 2013 at 13:27:47 UTC, jerro wrote:
> Aside from linker errors, there is one more (minor) issue with this approach. If there are multiple source files with the same name and there is no -of flag, DMD will generate an object file for just one of them. This could be worked around in rdmd by symlinking or copying files, but I think it would be better to fix it in DMD and use module.name.o instead of source_file_name.o for object file names.

What about -oq?
March 11, 2013
> What about -oq?

I assume you meant -op? I didn't know about -op flag, it seems it does solve this problem.
March 12, 2013
On Monday, 11 March 2013 at 19:44:31 UTC, jerro wrote:
>> What about -oq?
>
> I assume you meant -op? I didn't know about -op flag, it seems it does solve this problem.

Oops, it looks like -oq is something ldc-specific. It implements your exact suggestion (creates a.b.c.obj instead of c.obj or a/b/c.obj).
March 12, 2013
Am Tue, 12 Mar 2013 01:09:52 +0100
schrieb "Vladimir Panteleev" <vladimir@thecybershadow.net>:

> On Monday, 11 March 2013 at 19:44:31 UTC, jerro wrote:
> >> What about -oq?
> >
> > I assume you meant -op? I didn't know about -op flag, it seems it does solve this problem.
> 
> Oops, it looks like -oq is something ldc-specific. It implements your exact suggestion (creates a.b.c.obj instead of c.obj or a/b/c.obj).

And it implements other nice things, like:
* selective flags for in-contract, out-contract, assert, etc.
* using a debug build of Phobos when compiling in debug mode,
  so you get to keep Phobos' asserts while debugging.
* demoting GC allocations to stack allocations where objects
  don't leave the scope (making scoped!... unnecessary)

:) awesome

-- 
Marco

March 12, 2013
> Oops, it looks like -oq is something ldc-specific. It implements your exact suggestion (creates a.b.c.obj instead of c.obj or a/b/c.obj).

Thanks, didn't know about that one either. It does seem nice - too bad it's only supported by LDC.
March 12, 2013
On 3/12/13, jerro <a@a.com> wrote:
>> Oops, it looks like -oq is something ldc-specific. It implements your exact suggestion (creates a.b.c.obj instead of c.obj or a/b/c.obj).
>
> Thanks, didn't know about that one either. It does seem nice - too bad it's only supported by LDC.
>

You can always file an enhancement request. It's up to Walter to approve it though.
March 12, 2013

On 11.03.2013 14:21, Andrei Alexandrescu wrote:
> On 3/11/13 8:34 AM, Timon Gehr wrote:
>> On 03/11/2013 07:51 AM, Rainer Schuetze wrote:
>>> An import is listed in the module info struct as a dependency, if it has
>>> static constructors (or destructors) or if it imports modules that have
>>> static constructors.
>>> If a di-file misses an import, it might not end up
>>> in the imported modules list of an importing module, so the correct
>>> order cannot be determined at runtime.
>>> ( Search the dmd source for "needmoduleinfo", especially
>>> https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L150
>>>
>>>
>>> and
>>> https://github.com/D-Programming-Language/dmd/blob/master/src/import.c#L344
>>>
>>>
>>> )
>>>
>>> Also, you might run into trouble when removing static
>>> constructors/destructors from the di-file because of this.
>>>
>>
>> I see, thanks! IMO this is ridiculous. I'd argue it is an implementation
>> bug and should be fixed.
>
> Rainer, could you please file this to bugzilla?
>
> Thanks,
>
> Andrei

Done: http://d.puremagic.com/issues/show_bug.cgi?id=9697
March 17, 2013
On 2013-03-12 01:09, Vladimir Panteleev wrote:

> Oops, it looks like -oq is something ldc-specific. It implements your
> exact suggestion (creates a.b.c.obj instead of c.obj or a/b/c.obj).

http://d.puremagic.com/issues/show_bug.cgi?id=3541

-- 
/Jacob Carlborg