Mercurial > dwib
changeset 353:ab9fad4e98cb
Win: Remove winmain.c, it is no longer necessary in DW 3.2.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Thu, 25 Mar 2021 17:30:12 -0500 |
parents | a9a39f4ca93a |
children | 08dd2ae1eef0 |
files | dwib.c example.c makefile.vc winmain.c |
diffstat | 4 files changed, 5 insertions(+), 123 deletions(-) [+] |
line wrap: on
line diff
--- a/dwib.c Mon Mar 01 08:31:52 2021 -0600 +++ b/dwib.c Thu Mar 25 17:30:12 2021 -0500 @@ -7744,7 +7744,7 @@ } /* The main entry point. Notice we don't use WinMain() on Windows */ -int main(int argc, char *argv[]) +int dwmain(int argc, char *argv[]) { /* Enable full dark mode on platforms that support it */ if(getenv("DW_DARK_MODE"))
--- a/example.c Mon Mar 01 08:31:52 2021 -0600 +++ b/example.c Thu Mar 25 17:30:12 2021 -0500 @@ -15,7 +15,7 @@ } /* The main entry point. Notice we don't use WinMain() on Windows */ -int main(int argc, char *argv[]) +int dwmain(int argc, char *argv[]) { HWND window; DWIB handle;
--- a/makefile.vc Mon Mar 01 08:31:52 2021 -0600 +++ b/makefile.vc Thu Mar 25 17:30:12 2021 -0500 @@ -75,8 +75,7 @@ DEFFILE = win\dwib.def OBJS = dwib.obj \ - dwib_lib.obj \ - winmain.obj + dwib_lib.obj LIBOBJS = dwib_lib.obj @@ -132,11 +131,11 @@ $(WLIB) -def:$(DEFFILE) -machine:$(TARGET_CPU) -out:dwib.lib mt.exe -manifest dwib.dll.manifest win\dwib.dll.$(TARGET_CPU).manifest -outputresource:dwib.dll;2 -example.exe: example.obj winmain.obj +example.exe: example.obj $(LINK) @<< -out:$(@) -subsystem:windows $(LINKFLAGS) -example.obj winmain.obj +example.obj $(LIBS) dwib.lib <<
--- a/winmain.c Mon Mar 01 08:31:52 2021 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* Dynamic Windows stub file to allow Win32 applications - * to use the main() entry point instead of WinMain(). - * - * (C) 2000-2012 Brian Smith <brian@dbsoft.org> - */ - -#include <windows.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <process.h> - -#ifndef NODW -void Win32_Set_Instance(HINSTANCE hInstance); -#endif - -char **_convertargs(int *count, char *start, HINSTANCE DWInstance) -{ - char *tmp, *argstart, **argv; - int loc = 0, inquotes = 0; - - (*count) = 1; - - tmp = start; - - /* Count the number of entries */ - if(*start) - { - (*count)++; - - while(*tmp) - { - if(*tmp == '"' && inquotes) - inquotes = 0; - else if(*tmp == '"' && !inquotes) - inquotes = 1; - else if(*tmp == ' ' && !inquotes) - { - /* Push past any white space */ - while(*(tmp+1) == ' ') - tmp++; - /* If we aren't at the end of the command - * line increment the count. - */ - if(*(tmp+1)) - (*count)++; - } - tmp++; - } - } - - argv = (char **)malloc(sizeof(char *) * ((*count)+1)); - argv[0] = malloc(260); - GetModuleFileNameA(DWInstance, argv[0], 260); - - argstart = tmp = start; - - if(*start) - { - loc = 1; - - while(*tmp) - { - if(*tmp == '"' && inquotes) - { - *tmp = 0; - inquotes = 0; - } - else if(*tmp == '"' && !inquotes) - { - argstart = tmp+1; - inquotes = 1; - } - else if(*tmp == ' ' && !inquotes) - { - *tmp = 0; - argv[loc] = _strdup(argstart); - - /* Push past any white space */ - while(*(tmp+1) == ' ') - tmp++; - - /* Move the start pointer */ - argstart = tmp+1; - - /* If we aren't at the end of the command - * line increment the count. - */ - if(*(tmp+1)) - loc++; - } - tmp++; - } - if(*argstart) - argv[loc] = _strdup(argstart); - } - argv[loc+1] = NULL; - return argv; -} - -/* Protoype for the application entrypoint */ -int main(int argc, char **argv); - -/* Ok this is a really big hack but what the hell ;) */ -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) -{ - char **argv; - int argc; - -#ifndef NODW - Win32_Set_Instance(hInstance); -#endif - - argv = _convertargs(&argc, lpCmdLine, hInstance); - - return main(argc, argv); -}