Wrong module initialization order when building with Dub on Windows?

bauss jj_1337 at live.dk
Tue Oct 2 06:49:06 UTC 2018


On Tuesday, 2 October 2018 at 01:57:00 UTC, Vladimir Panteleev 
wrote:
> Ran into this today, don't have time to dig in now but maybe 
> someone ran into this too.
>
> Steps to reproduce:
>
> - git clone https://github.com/CyberShadow/ae
> - cd ae/demo/inputtiming
> - (download/unpack 
> https://www.libsdl.org/release/SDL2-2.0.8-win32-x86.zip or 
> https://www.libsdl.org/release/SDL2-2.0.8-win32-x64.zip to 
> current directory)
> - dub
>
> On Windows, I get a range violation (in ae.sys.log) which 
> indicates that Runtime.args has length 0, which should never 
> happen.
>
> This doesn't happen if I build as usual with rdmd, or on Linux 
> (either rdmd or Dub).

Honestly I would say that it should have worked regardless of the 
module order, because it's the runtime arguments.

Basically D's runtime should set them before ANY module 
constructors are called and most definitely before the main 
function is called.

So I'd say it's a bug with D's runtime and not necessary Dub.

You should be able to retrieve Runtime.args no matter where and 
when you attempt to do so in your program, as long as arguments 
are passed.

Of course if arguments passed are different between dub and rdmd 
then it's a bug, but if it's not and it's just because the 
modules are passed in different order, then I'd argue it's a bug 
with D's runtime.


More information about the Digitalmars-d-learn mailing list