From 27fa4199a27db67909887170a08927eade42e465 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 10 Oct 2017 22:03:40 +0200 Subject: Cleanup: remove unused winmain.cpp While we were diligently compiling and maintaining it, the WinMain entry point was completely unused for quite some time now (if it was ever used). gcc is perfectly happy with the standard main() entry point and even MSVC should be able to work with alternative entry point names (if anybody was bold enough to actually compile Inkscape that way) Note regarding code for output redirection: The code that was introduced in 378a6384e55bdb8c5750c051fd91302f64d2b69a in order to achieve console output from inkscape.exe (see comment in winconsole.cpp why this does not work by default) works in principle, but has a number of issues - it immediately exits (control is returned to the console) rendering it unsuitable (or even harmful) for script usage - despite returning control to the console Inkscape continues to print messages to it messing up any other output - standard input (stdin) is not working at all The solution of using console wrappers from b8859cd12327c84f5ca8d4bf8614f0d0913d3c25 is therefore still the preferable solution, see also https://bugs.launchpad.net/inkscape/+bug/520532 for details. --- src/winmain.cpp | 65 --------------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 src/winmain.cpp (limited to 'src/winmain.cpp') diff --git a/src/winmain.cpp b/src/winmain.cpp deleted file mode 100644 index 5120e44e0..000000000 --- a/src/winmain.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#ifdef G_OS_WIN32 -#undef DATADIR - -#include -#include -#include - -#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -#endif - -#include - -extern int main (int argc, char **argv); - -/* In case we build this as a windowed application */ - -#ifdef __GNUC__ -# ifndef _stdcall -# define _stdcall __attribute__((stdcall)) -# endif -#endif - -int _stdcall -WinMain (struct HINSTANCE__ */*hInstance*/, - struct HINSTANCE__ */*hPrevInstance*/, - char */*lpszCmdLine*/, - int /*nCmdShow*/) -{ - if (fileno (stdout) != -1 && - _get_osfhandle (fileno (stdout)) != -1) - { - /* stdout is fine, presumably redirected to a file or pipe */ - } - else - { - typedef BOOL (* WINAPI AttachConsole_t) (DWORD); - - AttachConsole_t p_AttachConsole = - (AttachConsole_t) GetProcAddress (GetModuleHandle ("kernel32.dll"), "AttachConsole"); - - if (p_AttachConsole != NULL && p_AttachConsole (ATTACH_PARENT_PROCESS)) - { - freopen ("CONOUT$", "w", stdout); - dup2 (fileno (stdout), 1); - freopen ("CONOUT$", "w", stderr); - dup2 (fileno (stderr), 2); - - } - } - - int ret; - ret = main (__argc, __argv); - return ret; -} - -#endif -- cgit v1.2.3