blob: 93817adfa531d823976e9db2d4e46d9e6f4a94de [file] [log] [blame]
Bram Moolenaaredf3f972016-08-29 22:49:24 +02001/* vi:set ts=8 sts=4 sw=4 noet:
Bram Moolenaar071d4272004-06-13 20:20:40 +00002 *
3 * VIM - Vi IMproved by Bram Moolenaar
4 * GUI support by Robert Webb
5 *
6 * Do ":help uganda" in Vim to read copying and usage conditions.
7 * Do ":help credits" in Vim to see a list of people who contributed.
8 * See README.txt for an overview of the Vim source code.
9 */
10/*
11 * Windows GUI: main program (EXE) entry point:
12 *
Bram Moolenaar760285d2019-03-27 21:59:45 +010013 * Ron Aaron <ronaharon@yahoo.com> wrote this and the DLL support code.
Bram Moolenaar071d4272004-06-13 20:20:40 +000014 */
15#include "vim.h"
16
17#ifdef __MINGW32__
18# ifndef _cdecl
19# define _cdecl
20# endif
21#endif
22
23/* cproto doesn't create a prototype for main() */
24int _cdecl
Bram Moolenaar4f974752019-02-17 17:44:42 +010025#if defined(FEAT_GUI_MSWIN)
Bram Moolenaar071d4272004-06-13 20:20:40 +000026VimMain
27#else
28 main
29#endif
Bram Moolenaarbaaa7e92016-01-29 22:47:03 +010030 (int argc, char **argv);
Bram Moolenaar7fae6362005-06-30 22:06:41 +000031static int (_cdecl *pmain)(int, char **);
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
33#ifndef PROTO
34#ifdef FEAT_GUI
Bram Moolenaar071d4272004-06-13 20:20:40 +000035void _cdecl SaveInst(HINSTANCE hInst);
Bram Moolenaar7fae6362005-06-30 22:06:41 +000036static void (_cdecl *pSaveInst)(HINSTANCE);
Bram Moolenaar071d4272004-06-13 20:20:40 +000037#endif
38
39 int WINAPI
40WinMain(
Bram Moolenaar1266d672017-02-01 13:43:36 +010041 HINSTANCE hInstance UNUSED,
42 HINSTANCE hPrevInst UNUSED,
Bram Moolenaar760285d2019-03-27 21:59:45 +010043 LPSTR lpszCmdLine UNUSED,
Bram Moolenaar1266d672017-02-01 13:43:36 +010044 int nCmdShow UNUSED)
Bram Moolenaar071d4272004-06-13 20:20:40 +000045{
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +000046 int argc = 0;
Bram Moolenaar760285d2019-03-27 21:59:45 +010047 char **argv = NULL;
Bram Moolenaar89828e92019-03-28 22:43:16 +010048#ifdef FEAT_GUI
Bram Moolenaar071d4272004-06-13 20:20:40 +000049 pSaveInst = SaveInst;
Bram Moolenaar89828e92019-03-28 22:43:16 +010050#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000051 pmain =
Bram Moolenaar89828e92019-03-28 22:43:16 +010052#if defined(FEAT_GUI_MSWIN)
Bram Moolenaar071d4272004-06-13 20:20:40 +000053 //&& defined(__MINGW32__)
54 VimMain
Bram Moolenaar89828e92019-03-28 22:43:16 +010055#else
Bram Moolenaar071d4272004-06-13 20:20:40 +000056 main
Bram Moolenaar071d4272004-06-13 20:20:40 +000057#endif
Bram Moolenaar89828e92019-03-28 22:43:16 +010058 ;
Bram Moolenaar071d4272004-06-13 20:20:40 +000059#ifdef FEAT_GUI
60 pSaveInst(
61#ifdef __MINGW32__
62 GetModuleHandle(NULL)
63#else
64 hInstance
65#endif
66 );
67#endif
68 pmain(argc, argv);
69
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +000070 free_cmd_argsW();
Bram Moolenaar071d4272004-06-13 20:20:40 +000071
72 return 0;
73}
74#endif