changeset 2956:afe9c20294ca

Win: Fix building dwtestoo with MinGW32/64. Need to use __cdecl in C++ mode. Also GCC 12 pukes on lambdas with stdio functions without #include <cstdio> GCC 8 compiled it fine without the include.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 06 Jan 2023 09:33:59 +0000
parents f99414164f5b
children 217ebbee034f
files dw.h dwtestoo.cpp makefile.mingw
diffstat 3 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Fri Jan 06 07:58:49 2023 +0000
+++ b/dw.h	Fri Jan 06 09:33:59 2023 +0000
@@ -599,11 +599,11 @@
 
 #if defined(MSVC) && !defined(API)
 # if defined(__MINGW32__) && defined(BUILD_DLL)
-#  define API _cdecl __declspec(dllexport)
+#  define API __cdecl __declspec(dllexport)
 # else
-#  define API _cdecl
+#  define API __cdecl
 #endif
-#define DWSIGNAL _cdecl
+#define DWSIGNAL __cdecl
 #endif
 
 #define DW_DT_LEFT               SS_LEFTNOWORDWRAP
--- a/dwtestoo.cpp	Fri Jan 06 07:58:49 2023 +0000
+++ b/dwtestoo.cpp	Fri Jan 06 09:33:59 2023 +0000
@@ -2,6 +2,7 @@
 // ground for Dynamic Windows features in C++.
 // By: Brian Smith and Mark Hessling
 #include "dw.hpp"
+#include <cstdio>
 
 // Select a fixed width font for our platform 
 #ifdef __OS2__
--- a/makefile.mingw	Fri Jan 06 07:58:49 2023 +0000
+++ b/makefile.mingw	Fri Jan 06 09:33:59 2023 +0000
@@ -1,8 +1,9 @@
 
 # Dynamic Windows MINGW Makefile
 
-CC = gcc
-RM = del /f
+CC  = gcc
+CXX = g++
+RM  = rm -f
 
 DEFS =
 LIBS =
@@ -32,7 +33,7 @@
 
 VPATH=../ ../win
 
-all: dw.dll dwcompat.dll dwtest.exe
+all: dw.dll dwcompat.dll dwtest.exe dwtestoo.exe
 
 dw.res:  win/dw.rc
 	windres --target=$(PLATFORM_TARGET) --input win/dw.rc --output dw.res --output-format=coff
@@ -47,10 +48,13 @@
 
 dwtest.res: win/dwtest.rc
 	windres --target=$(PLATFORM_TARGET) --input win/dwtest.rc --output dwtest.res --output-format=coff
-   
+
 dwtest.exe: dwtest.o dw.a dwcompat.a dwtest.res
 	$(CC) $(CFLAGS) -o dwtest.exe dwtest.res dwtest.o dw.a dwcompat.a
 
+dwtestoo.exe: dwtestoo.o dw.a dwcompat.a dwtest.res
+	$(CXX) $(CFLAGS) -o dwtestoo.exe dwtest.res dwtestoo.o dw.a dwcompat.a
+
 clean:
 	$(RM) *.obj *.o *.lib *.res *~ dwtest.exe dw.dll dwcompat.dll SVN.REV
 
@@ -72,6 +76,9 @@
 dwtest.o: dwtest.c
 	$(CC) $(CFLAGS) -c $<	
 
+dwtestoo.o: dwtestoo.cpp
+	$(CXX) -std=c++11 $(CFLAGS) -c $<	
+
 DEPS := $(wildcard *.d)
 ifneq ($(DEPS),)
 include $(DEPS)