www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Using D's precise GC when running an app with DUB

reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
How do I specify a druntime flag such as

     --DRT-gcopt=gc:precise

when running with dub as

     dub run --compiler=dmd --build=unittest

?

The precise GC flag was introduced in verison 2.085.0

See:
- https://dlang.org/changelog/2.085.0.html#gc_precise
- https://dlang.org/spec/garbage.html#precise_gc
May 23 2019
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 24/05/2019 2:50 AM, Per Nordlöw wrote:
 How do I specify a druntime flag such as
 
      --DRT-gcopt=gc:precise
 
 when running with dub as
 
      dub run --compiler=dmd --build=unittest
dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise
May 23 2019
next sibling parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 23 May 2019 at 14:51:41 UTC, rikki cattermole wrote:
 dub run --compiler=dmd --build=unittest -- 
 --DRT-gcopt=gc:precise
Thanks! And if I want to set this in a dub.sdl?
May 23 2019
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 24/05/2019 2:58 AM, Per Nordlöw wrote:
 On Thursday, 23 May 2019 at 14:51:41 UTC, rikki cattermole wrote:
 dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise
Thanks! And if I want to set this in a dub.sdl?
No can do. There is meant to be a way to set it in D however. But I have heard mixed results (not that I've tried it).
May 23 2019
parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 23 May 2019 at 15:02:12 UTC, rikki cattermole wrote:
 And if I want to set this in a dub.sdl?
No can do. There is meant to be a way to set it in D however. But I have heard mixed results (not that I've tried it).
Should be as easy as dflags "--DRT-gcopt=gc:precise" right?
May 23 2019
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 24/05/2019 3:03 AM, Per Nordlöw wrote:
 On Thursday, 23 May 2019 at 15:02:12 UTC, rikki cattermole wrote:
 And if I want to set this in a dub.sdl?
No can do. There is meant to be a way to set it in D however. But I have heard mixed results (not that I've tried it).
Should be as easy as     dflags "--DRT-gcopt=gc:precise" right?
That would be passed to dmd, not to the build executable upon running.
May 23 2019
parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 23 May 2019 at 15:05:15 UTC, rikki cattermole wrote:
 Should be as easy as
 
      dflags "--DRT-gcopt=gc:precise"
 
 right?
That would be passed to dmd, not to the build executable upon running.
You mean wise versa, right? Now I understand, --DRT-gcopt=gc:precise is passed to the resulting binary...
May 23 2019
parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 23 May 2019 at 15:25:31 UTC, Per Nordlöw wrote:
 You mean wise versa, right?
Nevermind that comment. No "wise versa". You're answer is correct, rikki cattermole. Thanks
May 24 2019
prev sibling parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 23 May 2019 at 14:51:41 UTC, rikki cattermole wrote:
 dub run --compiler=dmd --build=unittest -- 
 --DRT-gcopt=gc:precise
Hmm, the flag doesn't propagate to dmd when compiling in verbose mode via -v as dub run -v --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise Shouldn't it?
May 23 2019
parent rikki cattermole <rikki cattermole.co.nz> writes:
On 24/05/2019 3:01 AM, Per Nordlöw wrote:
 On Thursday, 23 May 2019 at 14:51:41 UTC, rikki cattermole wrote:
 dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise
Hmm, the flag doesn't propagate to dmd when compiling in verbose mode via -v as     dub run -v --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise Shouldn't it?
No. You told dub to -v. DFLAGS="-v" dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise
May 23 2019
prev sibling parent Eugene Wissner <belka caraus.de> writes:
On Thursday, 23 May 2019 at 14:50:12 UTC, Per Nordlöw wrote:
 How do I specify a druntime flag such as

     --DRT-gcopt=gc:precise

 when running with dub as

     dub run --compiler=dmd --build=unittest

 ?

 The precise GC flag was introduced in verison 2.085.0

 See:
 - https://dlang.org/changelog/2.085.0.html#gc_precise
 - https://dlang.org/spec/garbage.html#precise_gc
You can put into the source: extern(C) __gshared string[] rt_options = [ "gcopt=gc:precise" ]; you can wrap it into some "version ()" and set the version in the dub configuration.
May 23 2019