Mercurial > dwindows
changeset 2864:939fbceec13f
Win: Add support for building the C++ dwtestoo with Visual C.
Need to use dwmain() macro instead of standard main() entrypoint for Windows.
Had to move the _dw_convertargs() definition outside of the dwmain() macro.
The macro can be called from C++ code changing the function definition.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 17 Dec 2022 01:50:26 +0000 |
parents | f0a00c7c4ec1 |
children | fd32dce7fecd |
files | dw.h dwtestoo.cpp makefile.vc |
diffstat | 3 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/dw.h Fri Dec 16 13:33:29 2022 +0000 +++ b/dw.h Sat Dec 17 01:50:26 2022 +0000 @@ -1949,7 +1949,6 @@ #elif defined(__WIN32__) #define dwmain(a, b) \ _dwmain(a, b); \ -char ** API _dw_convertargs(int *count, char *start, HINSTANCE hInstance); \ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {\ int argc; \ char **argv = _dw_convertargs(&argc, lpCmdLine, hInstance); \ @@ -2248,6 +2247,10 @@ /* Exported for language bindings */ void API _dw_init_thread(void); void API _dw_deinit_thread(void); +/* Exported for WinMain handing macro on Windows */ +#ifdef __WIN32__ +char ** API _dw_convertargs(int *count, char *start, HINSTANCE hInstance); +#endif #ifdef __cplusplus }
--- a/dwtestoo.cpp Fri Dec 16 13:33:29 2022 +0000 +++ b/dwtestoo.cpp Sat Dec 17 01:50:26 2022 +0000 @@ -12,7 +12,7 @@ SetSize(200, 200); } -int main(int argc, char* argv[]) +int dwmain(int argc, char* argv[]) { DW::App *app = new DW::App(argc, argv, "org.dbsoft.dwindows.dwtestoo"); MyWindow *window = new MyWindow();
--- a/makefile.vc Fri Dec 16 13:33:29 2022 +0000 +++ b/makefile.vc Sat Dec 17 01:50:26 2022 +0000 @@ -125,7 +125,7 @@ OBJS2 = dwcompat.obj dirent.obj -all: dw dwcompat dwtest +all: dw dwcompat dwtest dwtestoo clean: -erase *.dll @@ -205,7 +205,7 @@ dwcompat.obj: $(SRCDIR)\dwcompat.c $(CC) $(CFLAGS) $(CFLAGS_DEBUG) $(SRCDIR)\dwcompat.c -dwtest.obj: $(SRCDIR)\dwtest.c +dwtest.obj: $(SRCDIR)\dwtest.c $(SRCDIR)\dw.h $(CC) $(CFLAGS) $(CFLAGS_DEBUG) $(SRCDIR)\dwtest.c dwtest: dwtest.exe @@ -215,6 +215,16 @@ mt.exe /manifest dwtest.exe.manifest $(SRCDIR)\win\dwtest.exe.$(TARGET_CPU).manifest /outputresource:dwtest.exe;1 -erase dwtest.exe.manifest +dwtestoo.obj: $(SRCDIR)\dwtestoo.cpp $(SRCDIR)\dw.h + $(CC) $(CFLAGS) $(CFLAGS_DEBUG) $(SRCDIR)\dwtestoo.cpp + +dwtestoo: dwtestoo.exe + +dwtestoo.exe: dwtestoo.obj + $(LINK) $(LINKFLAGS) /out:dwtestoo.exe dwtestoo.obj /subsystem:windows $(DWLIBDIR)\dwcompat.lib $(DWLIBDIR)\dw.lib $(LIBS) + mt.exe /manifest dwtestoo.exe.manifest $(SRCDIR)\win\dwtest.exe.$(TARGET_CPU).manifest /outputresource:dwtestoo.exe;1 + -erase dwtestoo.exe.manifest + zip: dw.dll copy win\readme-win.txt . zip dwindows-win-$(VERDOT).zip readme-win.txt readme.txt x64\dw.dll x64\dwcompat.dll x64\dw.lib x64\dwcompat.lib x86\dw.dll x86\dwcompat.dll x86\dw.lib x86\dwcompat.lib dw.h dwcompat.h