Building Win32 application via dub
Sam E.
sam.e at example.org
Wed Apr 29 09:43:53 UTC 2020
On Tuesday, 28 April 2020 at 20:18:29 UTC, Adam D. Ruppe wrote:
> On Tuesday, 28 April 2020 at 19:25:06 UTC, Sam E. wrote:
>> I'm a bit surprised to see a linking error given that building
>> directly from `dmd` seems to work fine without any flag.
>
> dmd directly uses -m32 whereas dub by default uses -m32mscoff
> to dmd.
>
> The mscoff linker (also used for -m64 btw) doesn't add the
> user32 library by default, you must explicitly add it.
>
> So with dub just add the user32 library to your config file and
> it should be ok. (I don't recall the syntax for that off the
> top of my head)
Thanks, that seems to link after adding `libs "user32"` to my
`dub.sdl` file.
Though the program built with dub is now crashing at runtime when
calling `writeln` within the `WinMain` block.
The exception error is:
> Exception has occurred: W32/0xc0000096
> Unhandled exception at 0x00007FF643C5AFE4 in test-win32.exe:
> 0xC0000096: Privileged instruction.
So it feels that something else is missing or wrong.
Any pointer would be helpful :)
Screenshot of the call site: https://postimg.cc/5YtY9PRQ
Screenshot of the expection: https://postimg.cc/K3vKz0pg
More information about the Digitalmars-d-learn
mailing list