diff src/os_w32exe.c @ 16451:7ae2396cef62 v8.1.1230

patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe commit https://github.com/vim/vim/commit/afde13b62b8fa25dac4635d5caee8d088b937ee0 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 28 19:46:49 2019 +0200 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe Problem: A lot of code is shared between vim.exe and gvim.exe. Solution: Optionally put the shared code in vim.dll. (Ken Takata, closes #4287)
author Bram Moolenaar <Bram@vim.org>
date Sun, 28 Apr 2019 20:00:10 +0200
parents b0e19f135e50
children 7e733046db1d
line wrap: on
line diff
--- a/src/os_w32exe.c
+++ b/src/os_w32exe.c
@@ -22,8 +22,11 @@
 #endif
 
 // cproto doesn't create a prototype for VimMain()
+#ifdef VIMDLL
+__declspec(dllimport)
+#endif
 int _cdecl VimMain(int argc, char **argv);
-#ifdef FEAT_GUI
+#ifndef VIMDLL
 void _cdecl SaveInst(HINSTANCE hInst);
 #endif
 
@@ -40,8 +43,12 @@ wWinMain(
 wmain(int argc UNUSED, wchar_t **argv UNUSED)
 # endif
 {
-# ifdef FEAT_GUI
+# ifndef VIMDLL
+#  ifdef FEAT_GUI
     SaveInst(hInstance);
+#  else
+    SaveInst(GetModuleHandleW(NULL));
+#  endif
 # endif
     VimMain(0, NULL);