www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How hide console in dub.sdl under windows 11?

reply John Xu <728308756 qq.com> writes:
For dmd, I can use a no_console.def file, which has:

     EXETYPE NT
     SUBSYSTEM WINDOWS


Then `dmd my.d no_console.def` to hide console.

But how do I realize it with dub.sdl ? Adding no_console.def to
"sourceFiles", doesn't help.
May 25 2023
next sibling parent a11e99z <black80 bk.ru> writes:
On Thursday, 25 May 2023 at 08:37:40 UTC, John Xu wrote:
 For dmd, I can use a no_console.def file, which has:

     EXETYPE NT
     SUBSYSTEM WINDOWS


 Then `dmd my.d no_console.def` to hide console.

 But how do I realize it with dub.sdl ? Adding no_console.def to
 "sourceFiles", doesn't help.
redirect to nul? ```command -args >nul 2>&1```
May 25 2023
prev sibling parent reply ryuukk_ <ryuukk.dev gmail.com> writes:
On Thursday, 25 May 2023 at 08:37:40 UTC, John Xu wrote:
 For dmd, I can use a no_console.def file, which has:

     EXETYPE NT
     SUBSYSTEM WINDOWS


 Then `dmd my.d no_console.def` to hide console.

 But how do I realize it with dub.sdl ? Adding no_console.def to
 "sourceFiles", doesn't help.
you can do that: ```json "lflags-windows": [ "/SUBSYSTEM:windows", ], ``` dub is too dumb, i think "sourceFiles" only accept .d
May 25 2023
parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 26/05/2023 2:21 AM, ryuukk_ wrote:
 dub is too dumb, i think "sourceFiles" only accept .d
Thats not true at all, its aware of what is a linker file and passes that off to the linker automatically: https://github.com/dlang/dub/blob/6dd0508d90b3c072e26fcd59fedd757205603071/source/dub/compilers/utils.d#L43 This should work with .def, if it doesn't there is a bug and needs reporting. https://github.com/dlang/dub/blob/6dd0508d90b3c072e26fcd59fedd757205603071/source/dub/generators/build.d#L632
May 25 2023