Re: Building Win32 application via dub

2020-04-29 Thread Sam E. via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 12:26:02 UTC, Mike Parker wrote: On Wednesday, 29 April 2020 at 11:55:54 UTC, Sam E. wrote: I cannot find a D example using Win32 and the normal main function, and while it is working for simple message boxes, as soon as I want to do something slightly more

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 11:55:54 UTC, Sam E. wrote: I cannot find a D example using Win32 and the normal main function, and while it is working for simple message boxes, as soon as I want to do something slightly more complex (using a window), an hInstance has to be provided (as far

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 11:55:54 UTC, Sam E. wrote: On Wednesday, 29 April 2020 at 10:46:30 UTC, Mike Parker wrote: On Wednesday, 29 April 2020 at 10:44:48 UTC, Mike Parker wrote: Yeah, it says "WinMain is needed", which has never been true. THere's no need for the def file either.

Re: Building Win32 application via dub

2020-04-29 Thread Sam E. via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:46:30 UTC, Mike Parker wrote: On Wednesday, 29 April 2020 at 10:44:48 UTC, Mike Parker wrote: Yeah, it says "WinMain is needed", which has never been true. THere's no need for the def file either. What's the way to get the hInstance without the use of

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:44:48 UTC, Mike Parker wrote: On Wednesday, 29 April 2020 at 10:26:40 UTC, Sam E. wrote: I took the WinMain from https://wiki.dlang.org/D_for_Win32, should that documentation be updated to use a normal main function instead? Also the details regarding

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:27:35 UTC, Sam E. wrote: To be honest, I haven't yet found the way to switch between -m32 and -m64 (or other) via dub :) Pass the -a flag on the dub command line with the appropriate argument: For -m32: -ax86 For -m32mscoff: -ax86_mscoff For -m64:

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:26:40 UTC, Sam E. wrote: I took the WinMain from https://wiki.dlang.org/D_for_Win32, should that documentation be updated to use a normal main function instead? Also the details regarding linker flags may be a good addition to that wiki page. Yeah, it

Re: Building Win32 application via dub

2020-04-29 Thread rikki cattermole via Digitalmars-d-learn
On 29/04/2020 10:27 PM, Sam E. wrote: To be honest, I haven't yet found the way to switch between -m32 and -m64 (or other) via dub :) $ dub build --arch=x86 $ dub build --arch=x86_64

Re: Building Win32 application via dub

2020-04-29 Thread Sam E. via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:26:40 UTC, Sam E. wrote: Really, there's no reason at all to use WinMain. Just create a standard main function. Then you don't need to worry about manually initializing the runtime and you'll have a console window by default. You can always turn it off in

Re: Building Win32 application via dub

2020-04-29 Thread Sam E. via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:12:29 UTC, Mike Parker wrote: Most likely because you're calling writeln before initializing the runtime. Of course, that was it, thanks for the help Mike! Also, when using WinMain, you aren't going to see any output from writeln because you won't have a

Re: Building Win32 application via dub

2020-04-29 Thread Sam E. via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:19:39 UTC, Ahmet Sait wrote: Though the program built with dub is now crashing at runtime when calling `writeln` within the `WinMain` block. Back then when I was trying to use writeln (or any standard output function like printf)in a non-console app in

Re: Building Win32 application via dub

2020-04-29 Thread Ahmet Sait via Digitalmars-d-learn
Though the program built with dub is now crashing at runtime when calling `writeln` within the `WinMain` block. Back then when I was trying to use writeln (or any standard output function like printf)in a non-console app in Windows it used to crash, I don't know exact reason behind it but you

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 09:43:53 UTC, Sam E. wrote: 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/0xc096 Unhandled exception at 0x7FF643C5AFE4 in

Re: Building Win32 application via dub

2020-04-29 Thread Sam E. via Digitalmars-d-learn
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

Re: Building Win32 application via dub

2020-04-28 Thread Adam D. Ruppe via Digitalmars-d-learn
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)

Building Win32 application via dub

2020-04-28 Thread Sam E. via Digitalmars-d-learn
Hi, I'm fairly new to D, just playing around with Win32 bindings. I have a Win32 hello world that works when build via `dmd .\source\app test-win32.def`. I'm now trying to build the application via `dub`, but I cannot find what configuration I would need to do so. By default, just running