Mercurial > vim
annotate src/os_w32exe.c @ 16111:c0961d9ac269 v8.1.1060
patch 8.1.1060: MS-Windows: get_cmd_args() is no longer needed
commit https://github.com/vim/vim/commit/760285dd4f20d25e8ae3166996981b8dddba366a
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 27 21:59:45 2019 +0100
patch 8.1.1060: MS-Windows: get_cmd_args() is no longer needed
Problem: MS-Windows: get_cmd_args() is no longer needed, get_cmd_argsW() is
always used.
Solution: Remove get_cmd_args(). (Ken Takata, closes #4171)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 27 Mar 2019 22:00:07 +0100 |
parents | 7fad90423bd2 |
children | a246b020984c |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
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 * | |
16111
c0961d9ac269
patch 8.1.1060: MS-Windows: get_cmd_args() is no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
15868
diff
changeset
|
13 * Ron Aaron <ronaharon@yahoo.com> wrote this and the DLL support code. |
7 | 14 */ |
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() */ | |
24 int _cdecl | |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15603
diff
changeset
|
25 #if defined(FEAT_GUI_MSWIN) |
7 | 26 VimMain |
27 #else | |
28 main | |
29 #endif | |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7613
diff
changeset
|
30 (int argc, char **argv); |
379 | 31 static int (_cdecl *pmain)(int, char **); |
7 | 32 |
33 #ifndef PROTO | |
34 #ifdef FEAT_GUI | |
35 #ifndef VIMDLL | |
36 void _cdecl SaveInst(HINSTANCE hInst); | |
37 #endif | |
379 | 38 static void (_cdecl *pSaveInst)(HINSTANCE); |
7 | 39 #endif |
40 | |
41 int WINAPI | |
42 WinMain( | |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
43 HINSTANCE hInstance UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
44 HINSTANCE hPrevInst UNUSED, |
16111
c0961d9ac269
patch 8.1.1060: MS-Windows: get_cmd_args() is no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
15868
diff
changeset
|
45 LPSTR lpszCmdLine UNUSED, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
46 int nCmdShow UNUSED) |
7 | 47 { |
23 | 48 int argc = 0; |
16111
c0961d9ac269
patch 8.1.1060: MS-Windows: get_cmd_args() is no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
15868
diff
changeset
|
49 char **argv = NULL; |
c0961d9ac269
patch 8.1.1060: MS-Windows: get_cmd_args() is no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
15868
diff
changeset
|
50 #ifdef VIMDLL |
7 | 51 char prog[256]; |
52 char *p; | |
53 HANDLE hLib; | |
54 | |
55 /* Ron: added full path name so that the $VIM variable will get set to our | |
56 * startup path (so the .vimrc file can be found w/o a VIM env. var.) */ | |
57 GetModuleFileName(NULL, prog, 255); | |
58 | |
16111
c0961d9ac269
patch 8.1.1060: MS-Windows: get_cmd_args() is no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
15868
diff
changeset
|
59 # ifdef DYNAMIC_GETTEXT |
7 | 60 /* Initialize gettext library */ |
7613
4456fa2d22e8
commit https://github.com/vim/vim/commit/286eacd3f6631e985089176fb1dff1bcf1a1d6b5
Christian Brabandt <cb@256bit.org>
parents:
1738
diff
changeset
|
61 dyn_libintl_init(); |
16111
c0961d9ac269
patch 8.1.1060: MS-Windows: get_cmd_args() is no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
15868
diff
changeset
|
62 # endif |
7 | 63 |
64 // LoadLibrary - get name of dll to load in here: | |
65 p = strrchr(prog, '\\'); | |
66 if (p != NULL) | |
67 { | |
68 # ifdef DEBUG | |
69 strcpy(p+1, "vim32d.dll"); | |
70 # else | |
71 strcpy(p+1, "vim32.dll"); | |
72 # endif | |
73 } | |
74 hLib = LoadLibrary(prog); | |
75 if (hLib == NULL) | |
76 { | |
77 MessageBox(0, _("Could not load vim32.dll!"), _("VIM Error"), 0); | |
78 goto errout; | |
79 } | |
80 // fix up the function pointers | |
81 # ifdef FEAT_GUI | |
82 pSaveInst = GetProcAddress(hLib, (LPCSTR)2); | |
83 # endif | |
84 pmain = GetProcAddress(hLib, (LPCSTR)1); | |
85 if (pmain == NULL) | |
86 { | |
87 MessageBox(0, _("Could not fix up function pointers to the DLL!"), | |
88 _("VIM Error"),0); | |
89 goto errout; | |
90 } | |
91 #else | |
92 # ifdef FEAT_GUI | |
93 pSaveInst = SaveInst; | |
94 # endif | |
95 pmain = | |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15603
diff
changeset
|
96 # if defined(FEAT_GUI_MSWIN) |
7 | 97 //&& defined(__MINGW32__) |
98 VimMain | |
99 # else | |
100 main | |
101 # endif | |
102 ; | |
103 #endif | |
104 #ifdef FEAT_GUI | |
105 pSaveInst( | |
106 #ifdef __MINGW32__ | |
107 GetModuleHandle(NULL) | |
108 #else | |
109 hInstance | |
110 #endif | |
111 ); | |
112 #endif | |
113 pmain(argc, argv); | |
114 | |
115 #ifdef VIMDLL | |
116 FreeLibrary(hLib); | |
117 errout: | |
118 #endif | |
26 | 119 free_cmd_argsW(); |
7 | 120 |
121 return 0; | |
122 } | |
123 #endif |