[PATCH vkd3d 2/2] demos: Support building on Windows without -DUNICODE.
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- demos/demo_win32.h | 6 +++--- demos/gears.c | 2 +- demos/triangle.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/demos/demo_win32.h b/demos/demo_win32.h index d2a54989e9a7..53fbc06351a1 100644 --- a/demos/demo_win32.h +++ b/demos/demo_win32.h @@ -200,12 +200,12 @@ static inline bool demo_init(struct demo *demo, void *user_data) wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = GetModuleHandle(NULL); - wc.hIcon = LoadIconW(NULL, IDI_APPLICATION); - wc.hCursor = LoadCursorW(NULL, IDC_ARROW); + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = DEMO_WINDOW_CLASS_NAME; - wc.hIconSm = LoadIconW(NULL, IDI_WINLOGO); + wc.hIconSm = LoadIcon(NULL, IDI_WINLOGO); if (!RegisterClassExW(&wc)) return false; diff --git a/demos/gears.c b/demos/gears.c index 2045b3cdd842..9ed87b1084cf 100644 --- a/demos/gears.c +++ b/demos/gears.c @@ -877,7 +877,7 @@ static int cxg_main(void) return EXIT_SUCCESS; } -#ifdef _WIN32 +#if defined(_WIN32) && defined(_UNICODE) int wmain(void) #else int main(void) diff --git a/demos/triangle.c b/demos/triangle.c index bac1cdc59d88..77bd128957fa 100644 --- a/demos/triangle.c +++ b/demos/triangle.c @@ -392,7 +392,7 @@ static int cxt_main(void) return EXIT_SUCCESS; } -#ifdef _WIN32 +#if defined(_WIN32) && defined(_UNICODE) int wmain(void) #else int main(void) -- 2.34.1
On Tue, 22 Feb 2022 at 20:00, Alexandre Julliard <julliard(a)winehq.org> wrote:
diff --git a/demos/gears.c b/demos/gears.c index 2045b3cdd842..9ed87b1084cf 100644 --- a/demos/gears.c +++ b/demos/gears.c @@ -877,7 +877,7 @@ static int cxg_main(void) return EXIT_SUCCESS; }
-#ifdef _WIN32 +#if defined(_WIN32) && defined(_UNICODE) int wmain(void) #else int main(void)
Shouldn't that check for "defined(UNICODE)" instead? As-is, this breaks "make crosstest": i686-w64-mingw32-gcc -g -O2 -Wall -municode -I<vkd3d>/include -I<vkd3d>/include/private -I./include -D__USE_MINGW_ANSI_STDIO=0 -MT demos/gears.cross32.exe -MD -MP -MF $depbase.Tpo -o demos/gears.cross32.exe <vkd3d>/demos/gears.c crosslibs/d3d12.cross32.a -ldxgi -lgdi32 -ld3dcompiler_47 && \ mv -f $depbase.Tpo $depbase.Po /usr/bin/i686-w64-mingw32-ld: /usr/lib/gcc/i686-w64-mingw32/8.3-win32/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_w.o): in function `wmain': ./build/i686-w64-mingw32-i686-w64-mingw32-crt/./mingw-w64-crt/crt/crt0_w.c:23: undefined reference to `wWinMain(a)16'
Henri Verbeet <hverbeet(a)gmail.com> writes:
On Tue, 22 Feb 2022 at 20:00, Alexandre Julliard <julliard(a)winehq.org> wrote:
diff --git a/demos/gears.c b/demos/gears.c index 2045b3cdd842..9ed87b1084cf 100644 --- a/demos/gears.c +++ b/demos/gears.c @@ -877,7 +877,7 @@ static int cxg_main(void) return EXIT_SUCCESS; }
-#ifdef _WIN32 +#if defined(_WIN32) && defined(_UNICODE) int wmain(void) #else int main(void)
Shouldn't that check for "defined(UNICODE)" instead? As-is, this breaks "make crosstest":
Actually, is there a reason we are using -municode for crosstests? -- Alexandre Julliard julliard(a)winehq.org
On Wed, 23 Feb 2022 at 16:03, Alexandre Julliard <julliard(a)winehq.org> wrote:
Henri Verbeet <hverbeet(a)gmail.com> writes:
On Tue, 22 Feb 2022 at 20:00, Alexandre Julliard <julliard(a)winehq.org> wrote:
diff --git a/demos/gears.c b/demos/gears.c index 2045b3cdd842..9ed87b1084cf 100644 --- a/demos/gears.c +++ b/demos/gears.c @@ -877,7 +877,7 @@ static int cxg_main(void) return EXIT_SUCCESS; }
-#ifdef _WIN32 +#if defined(_WIN32) && defined(_UNICODE) int wmain(void) #else int main(void)
Shouldn't that check for "defined(UNICODE)" instead? As-is, this breaks "make crosstest":
Actually, is there a reason we are using -municode for crosstests?
I don't think there's a strong reason. IIRC it was just for making sure we get the W-variants of functions by default. I.e., preventing accidents along the lines of using CreateWindowExW() in demo_window_create(), but then using DefWindowProc() in demo_window_proc().
Henri Verbeet <hverbeet(a)gmail.com> writes:
On Wed, 23 Feb 2022 at 16:03, Alexandre Julliard <julliard(a)winehq.org> wrote:
Henri Verbeet <hverbeet(a)gmail.com> writes:
On Tue, 22 Feb 2022 at 20:00, Alexandre Julliard <julliard(a)winehq.org> wrote:
diff --git a/demos/gears.c b/demos/gears.c index 2045b3cdd842..9ed87b1084cf 100644 --- a/demos/gears.c +++ b/demos/gears.c @@ -877,7 +877,7 @@ static int cxg_main(void) return EXIT_SUCCESS; }
-#ifdef _WIN32 +#if defined(_WIN32) && defined(_UNICODE) int wmain(void) #else int main(void)
Shouldn't that check for "defined(UNICODE)" instead? As-is, this breaks "make crosstest":
Actually, is there a reason we are using -municode for crosstests?
I don't think there's a strong reason. IIRC it was just for making sure we get the W-variants of functions by default. I.e., preventing accidents along the lines of using CreateWindowExW() in demo_window_create(), but then using DefWindowProc() in demo_window_proc().
This would then require the Mingw build to force -municode as well. Do you want this, or should I remove -municode? -- Alexandre Julliard julliard(a)winehq.org
On Wed, 23 Feb 2022 at 16:56, Alexandre Julliard <julliard(a)winehq.org> wrote:
Henri Verbeet <hverbeet(a)gmail.com> writes:
On Wed, 23 Feb 2022 at 16:03, Alexandre Julliard <julliard(a)winehq.org> wrote:
Actually, is there a reason we are using -municode for crosstests?
I don't think there's a strong reason. IIRC it was just for making sure we get the W-variants of functions by default. I.e., preventing accidents along the lines of using CreateWindowExW() in demo_window_create(), but then using DefWindowProc() in demo_window_proc().
This would then require the Mingw build to force -municode as well. Do you want this, or should I remove -municode?
I think I'd prefer the Win32 build setting -municode, yes. It's not a very strong preference though, so if you feel removing -municode would be better, that's fine too.
participants (2)
-
Alexandre Julliard -
Henri Verbeet