Problem: Dynamic library load error does not mention why it failed.
Solution: Add the error message. (Martin Tournoij, closes #8621)
|| defined(DYNAMIC_MZSCHEME) \
|| defined(DYNAMIC_LUA) \
|| defined(FEAT_TERMINAL)
-EXTERN char e_loadlib[] INIT(= N_("E370: Could not load library %s"));
+EXTERN char e_loadlib[] INIT(= N_("E370: Could not load library %s: %s"));
EXTERN char e_loadfunc[] INIT(= N_("E448: Could not load library function %s"));
#endif
EXTERN char e_nobang[] INIT(= N_("E477: No ! allowed"));
#endif
}
-#ifndef UNIX
- static char *
-GetWin32Error(void)
-{
- char *msg = NULL;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
- NULL, GetLastError(), 0, (LPSTR)&msg, 0, NULL);
- if (msg != NULL)
- {
- // remove trailing \r\n
- char *pcrlf = strstr(msg, "\r\n");
- if (pcrlf != NULL)
- *pcrlf = '\0';
- }
- return msg;
-}
-#endif
-
/*
* Insert a new cscope database filename into the filelist.
*/
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
# define symbol_from_dll dlsym
# define close_dll dlclose
+# define load_dll_error dlerror
#else
# define load_dll vimLoadLib
# define symbol_from_dll GetProcAddress
# define close_dll FreeLibrary
+# define load_dll_error GetWin32Error
#endif
// lauxlib
if (!hinstLua)
{
if (verbose)
- semsg(_(e_loadlib), libname);
+ semsg(_(e_loadlib), libname, load_dll_error());
return FAIL;
}
for (reg = luaV_dll; reg->func; reg++)
if (!hMzGC)
{
if (verbose)
- semsg(_(e_loadlib), gc_dll);
+ semsg(_(e_loadlib), gc_dll, GetWin32Error());
return FAIL;
}
if (!hMzSch)
{
if (verbose)
- semsg(_(e_loadlib), sch_dll);
+ semsg(_(e_loadlib), sch_dll, GetWin32Error());
return FAIL;
}
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
# define symbol_from_dll dlsym
# define close_dll dlclose
+# define load_dll_error dlerror
# else
# define PERL_PROC FARPROC
# define load_dll vimLoadLib
# define symbol_from_dll GetProcAddress
# define close_dll FreeLibrary
+# define load_dll_error GetWin32Error
# endif
/*
* Wrapper defines
# endif
# define close_dll dlclose
# define symbol_from_dll dlsym
+# define load_dll_error dlerror
# else
# define load_dll vimLoadLib
# define close_dll FreeLibrary
# define symbol_from_dll GetProcAddress
+# define load_dll_error GetWin32Error
# endif
// This makes if_python.c compile without warnings against Python 2.5
if (!hinstPython)
{
if (verbose)
- semsg(_(e_loadlib), libname);
+ semsg(_(e_loadlib), libname, load_dll_error());
return FAIL;
}
# endif
# define close_dll dlclose
# define symbol_from_dll dlsym
+# define load_dll_error dlerror
# else
# define load_dll vimLoadLib
# define close_dll FreeLibrary
# define symbol_from_dll GetProcAddress
+# define load_dll_error GetWin32Error
# endif
/*
* Wrapper defines
if (!hinstPy3)
{
if (verbose)
- semsg(_(e_loadlib), libname);
+ semsg(_(e_loadlib), libname, load_dll_error());
return FAIL;
}
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
# define symbol_from_dll dlsym
# define close_dll dlclose
+# define load_dll_error dlerror
# else
# define RUBY_PROC FARPROC
# define load_dll vimLoadLib
# define symbol_from_dll GetProcAddress
# define close_dll FreeLibrary
+# define load_dll_error GetWin32Error
# endif
#endif
if (!hinstRuby)
{
if (verbose)
- semsg(_(e_loadlib), libname);
+ semsg(_(e_loadlib), libname, load_dll_error());
return FAIL;
}
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
# define symbol_from_dll dlsym
# define close_dll dlclose
+# define load_dll_error dlerror
# else
# define TCL_PROC FARPROC
# define load_dll vimLoadLib
# define symbol_from_dll GetProcAddress
# define close_dll FreeLibrary
+# define load_dll_error GetWin32Error
# endif
/*
if (!(hTclLib = load_dll(libname)))
{
if (verbose)
- semsg(_(e_loadlib), libname);
+ semsg(_(e_loadlib), libname, load_dll_error());
return FAIL;
}
for (i = 0; tcl_funcname_table[i].ptr; ++i)
{
verbose_enter();
semsg(_(e_loadlib),
- hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL);
+ hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL,
+ GetWin32Error());
verbose_leave();
}
iconv_end();
if (p_verbose > 0)
{
verbose_enter();
- semsg(_(e_loadlib), GETTEXT_DLL);
+ semsg(_(e_loadlib), GETTEXT_DLL, GetWin32Error());
verbose_leave();
}
return 0;
}
}
#endif
+
+ char *
+GetWin32Error(void)
+{
+ char *msg = NULL;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, GetLastError(), 0, (LPSTR)&msg, 0, NULL);
+ if (msg != NULL)
+ {
+ // remove trailing \r\n
+ char *pcrlf = strstr(msg, "\r\n");
+ if (pcrlf != NULL)
+ *pcrlf = '\0';
+ }
+ return msg;
+}
int is_conpty_stable(void);
int get_conpty_fix_type(void);
void resize_console_buf(void);
+char * GetWin32Error(void);
/* vim: set ft=c : */
if (!hWinPtyDLL)
{
if (verbose)
- semsg(_(e_loadlib), *p_winptydll != NUL ? p_winptydll
- : (char_u *)WINPTY_DLL);
+ semsg(_(e_loadlib),
+ (*p_winptydll != NUL ? p_winptydll : (char_u *)WINPTY_DLL),
+ GetWin32Error());
return FAIL;
}
for (i = 0; winpty_entry[i].name != NULL
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3208,
/**/
3207,
/**/