# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1671400752 0 # Node ID 4b7c4cd7a11d3e47403c1bdab265b76b773d7705 # Parent 7b4e30c19757ddf9b85bdb1f8c88e6fa5d597847 OS2: Fix building the C++ bindings on OS/2 with GCC. diff -r 7b4e30c19757 -r 4b7c4cd7a11d dw.hpp --- 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(classptr); diff -r 7b4e30c19757 -r 4b7c4cd7a11d dwtestoo.cpp --- 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 +#include "dw.hpp" class MyWindow : public DW::Window { diff -r 7b4e30c19757 -r 4b7c4cd7a11d makefile.emx --- 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