changeset 2871:4b7c4cd7a11d

OS2: Fix building the C++ bindings on OS/2 with GCC.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 18 Dec 2022 21:59:12 +0000
parents 7b4e30c19757
children e62fc9b3b09c
files dw.hpp dwtestoo.cpp makefile.emx
diffstat 3 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dw.hpp	Sun Dec 18 13:33:22 2022 +0000
+++ b/dw.hpp	Sun Dec 18 21:59:12 2022 +0000
@@ -44,11 +44,11 @@
 {
 public:
     void PackStart(Widget *item, int width, int height, int hsize, int vsize, int pad) { 
-        dw_box_pack_start(hwnd, item ? item->GetHWND() : nullptr, width, height, hsize, vsize, pad); }
+        dw_box_pack_start(hwnd, item ? item->GetHWND() : DW_NOHWND, width, height, hsize, vsize, pad); }
     void PackEnd(Widget *item, int width, int height, int hsize, int vsize, int pad) { 
-        dw_box_pack_end(hwnd, item ? item->GetHWND() : nullptr, width, height, hsize, vsize, pad); }
+        dw_box_pack_end(hwnd, item ? item->GetHWND() : DW_NOHWND, width, height, hsize, vsize, pad); }
     void PackAtIndex(Widget *item, int index, int width, int height, int hsize, int vsize, int pad) { 
-        dw_box_pack_at_index(hwnd, item ? item->GetHWND() : nullptr, index, width, height, hsize, vsize, pad); }
+        dw_box_pack_at_index(hwnd, item ? item->GetHWND() : DW_NOHWND, index, width, height, hsize, vsize, pad); }
     Widget *UnpackAtIndex(int index) { HWND widget = dw_box_unpack_at_index(hwnd, index);
         void *classptr = widget ? dw_window_get_data(widget, "_dw_classptr") : nullptr;
         return reinterpret_cast<Widget *>(classptr);
--- a/dwtestoo.cpp	Sun Dec 18 13:33:22 2022 +0000
+++ b/dwtestoo.cpp	Sun Dec 18 21:59:12 2022 +0000
@@ -1,7 +1,7 @@
 /*
  * Simple C++ Dynamic Windows Example
  */
-#include <dw.hpp>
+#include "dw.hpp"
 
 class MyWindow : public DW::Window
 {
--- a/makefile.emx	Sun Dec 18 13:33:22 2022 +0000
+++ b/makefile.emx	Sun Dec 18 21:59:12 2022 +0000
@@ -24,7 +24,7 @@
 COMPATOBJECTS = dwcompat.obj dirent.obj
 COMPATSOURCES = dwcompat.c dirent.c
 
-all: dw.dll dwcompat.dll dwtest.exe
+all: dw.dll dwcompat.dll dwtest.exe dwtestoo.exe
 
 dw.dll:  os2\dw.c os2\dw.def
 	$(CC) $(CFLAGS) $(DEFS) -o dw.dll os2/dw.c $(LDFLAGS) os2/dw.def
@@ -38,11 +38,15 @@
 dwcompat.lib: os2\dwcompat.def
 	emximp -o dwcompat.lib os2\dwcompat.def
 
-dwtest.exe: dwtest.o dw.lib dwcompat.lib
-	$(CC) $(CFLAGS) -Zomf -Zmt -static-libgcc -Zlinker /pm:pm -o dwtest.exe dwtest.o -Llib -ldw -ldwcompat os2/dwtest.def
+dwtest.exe: dwtest.obj dw.lib dwcompat.lib
+	$(CC) $(CFLAGS) -Zomf -Zmt -static-libgcc -Zlinker /pm:pm -o dwtest.exe dwtest.obj -Llib -ldw -ldwcompat os2/dwtest.def
+
+dwtestoo.exe: dwtestoo.obj dw.lib dwcompat.lib
+	$(CC) $(CFLAGS) -Zomf -Zmt -static-libgcc -Zlinker /pm:pm -o dwtestoo.exe dwtestoo.obj -Llib -ldw -ldwcompat -lstdc++ os2/dwtest.def
+
 
 clean:
-	$(RM) *.obj *.o *.lib *.res *~ dwtest.exe dw.dll dwcompat.dll SVN.REV
+	$(RM) *.obj *.o *.lib *.res *~ dwtest.exe dwtestoo.exe dw.dll dwcompat.dll SVN.REV
 
 dw.obj: dw.c
 	$(CC) $(CFLAGS) -c $<	
@@ -56,6 +60,10 @@
 dwtest.obj: dwtest.c
 	$(CC) $(CFLAGS) -c $<	
 
+dwtestoo.obj: dwtestoo.cpp
+	$(CC) $(CFLAGS) -std=c++11 -c $<	
+
+
 zip: dw.dll
 	cp os2/readme-os2.txt .
 	zip dwindows-os2-$(VERDOT).zip readme-os2.txt readme.txt dw.dll dwcompat.dll dw.lib dwcompat.lib dw.h dwcompat.h