| |
| Posted by Mike Parker in reply to WhatMe Worry | PermalinkReply |
|
Mike Parker
Posted in reply to WhatMe Worry
| On Friday, 8 May 2020 at 21:00:12 UTC, WhatMe Worry wrote:
>
>
> This is a beginner's question but how to I get past this?
>
> C:\Users\Kyle\AppData\Local\dub\packages\arsd-official-7.2.0\arsd-official>lld-link terminal.obj
>
> lld-link: error: subsystem must be defined
>
> help mentions this option, but
> /subsystem:<value> Specify subsystem
>
> Is there a good tutorial for ldc2 because I haven't been able to find anything.
No matter the linker one uses (OPTLINK, MS link, lld), there are two "subsystems" for Windows program: Windows and Console. The latter starts with console window, the former does not.
Generally, when using the Windows subsystem, WinMain is required (and in D, DRuntime must be manually initialized). When using the Console subsystem, main is required. OPTLINK, however, will accept main with the Windows subsystem just fine. MS link can be configured with the /ENTRY flag to accept either main or WinMain in either subsystem (e.g., /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup).
So for lld, you'll want /subsystem:windows for no console window or /subsystem:console if you want the console. You can still use main with /subsystem:windows by also passing /entry:main.
|