forked from aniani/vim
patch 8.2.3208: dynamic library load error does not mention why it failed
Problem: Dynamic library load error does not mention why it failed. Solution: Add the error message. (Martin Tournoij, closes #8621)
This commit is contained in:
parent
5a234eb18e
commit
1a3e5747b7
@ -1632,7 +1632,7 @@ EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed"));
|
|||||||
|| defined(DYNAMIC_MZSCHEME) \
|
|| defined(DYNAMIC_MZSCHEME) \
|
||||||
|| defined(DYNAMIC_LUA) \
|
|| defined(DYNAMIC_LUA) \
|
||||||
|| defined(FEAT_TERMINAL)
|
|| 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"));
|
EXTERN char e_loadfunc[] INIT(= N_("E448: Could not load library function %s"));
|
||||||
#endif
|
#endif
|
||||||
EXTERN char e_nobang[] INIT(= N_("E477: No ! allowed"));
|
EXTERN char e_nobang[] INIT(= N_("E477: No ! allowed"));
|
||||||
|
@ -1329,24 +1329,6 @@ clear_csinfo(int i)
|
|||||||
#endif
|
#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.
|
* Insert a new cscope database filename into the filelist.
|
||||||
*/
|
*/
|
||||||
|
@ -105,10 +105,12 @@ static void luaV_call_lua_func_free(void *state);
|
|||||||
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
||||||
# define symbol_from_dll dlsym
|
# define symbol_from_dll dlsym
|
||||||
# define close_dll dlclose
|
# define close_dll dlclose
|
||||||
|
# define load_dll_error dlerror
|
||||||
#else
|
#else
|
||||||
# define load_dll vimLoadLib
|
# define load_dll vimLoadLib
|
||||||
# define symbol_from_dll GetProcAddress
|
# define symbol_from_dll GetProcAddress
|
||||||
# define close_dll FreeLibrary
|
# define close_dll FreeLibrary
|
||||||
|
# define load_dll_error GetWin32Error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// lauxlib
|
// lauxlib
|
||||||
@ -446,7 +448,7 @@ lua_link_init(char *libname, int verbose)
|
|||||||
if (!hinstLua)
|
if (!hinstLua)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
semsg(_(e_loadlib), libname);
|
semsg(_(e_loadlib), libname, load_dll_error());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
for (reg = luaV_dll; reg->func; reg++)
|
for (reg = luaV_dll; reg->func; reg++)
|
||||||
|
@ -668,14 +668,14 @@ mzscheme_runtime_link_init(char *sch_dll, char *gc_dll, int verbose)
|
|||||||
if (!hMzGC)
|
if (!hMzGC)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
semsg(_(e_loadlib), gc_dll);
|
semsg(_(e_loadlib), gc_dll, GetWin32Error());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hMzSch)
|
if (!hMzSch)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
semsg(_(e_loadlib), sch_dll);
|
semsg(_(e_loadlib), sch_dll, GetWin32Error());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,11 +175,13 @@ typedef int perl_key;
|
|||||||
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
||||||
# define symbol_from_dll dlsym
|
# define symbol_from_dll dlsym
|
||||||
# define close_dll dlclose
|
# define close_dll dlclose
|
||||||
|
# define load_dll_error dlerror
|
||||||
# else
|
# else
|
||||||
# define PERL_PROC FARPROC
|
# define PERL_PROC FARPROC
|
||||||
# define load_dll vimLoadLib
|
# define load_dll vimLoadLib
|
||||||
# define symbol_from_dll GetProcAddress
|
# define symbol_from_dll GetProcAddress
|
||||||
# define close_dll FreeLibrary
|
# define close_dll FreeLibrary
|
||||||
|
# define load_dll_error GetWin32Error
|
||||||
# endif
|
# endif
|
||||||
/*
|
/*
|
||||||
* Wrapper defines
|
* Wrapper defines
|
||||||
|
@ -141,10 +141,12 @@ struct PyMethodDef { Py_ssize_t a; };
|
|||||||
# endif
|
# endif
|
||||||
# define close_dll dlclose
|
# define close_dll dlclose
|
||||||
# define symbol_from_dll dlsym
|
# define symbol_from_dll dlsym
|
||||||
|
# define load_dll_error dlerror
|
||||||
# else
|
# else
|
||||||
# define load_dll vimLoadLib
|
# define load_dll vimLoadLib
|
||||||
# define close_dll FreeLibrary
|
# define close_dll FreeLibrary
|
||||||
# define symbol_from_dll GetProcAddress
|
# define symbol_from_dll GetProcAddress
|
||||||
|
# define load_dll_error GetWin32Error
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
// This makes if_python.c compile without warnings against Python 2.5
|
// This makes if_python.c compile without warnings against Python 2.5
|
||||||
@ -688,7 +690,7 @@ python_runtime_link_init(char *libname, int verbose)
|
|||||||
if (!hinstPython)
|
if (!hinstPython)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
semsg(_(e_loadlib), libname);
|
semsg(_(e_loadlib), libname, load_dll_error());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,10 +125,12 @@ typedef PySliceObject PySliceObject_T;
|
|||||||
# endif
|
# endif
|
||||||
# define close_dll dlclose
|
# define close_dll dlclose
|
||||||
# define symbol_from_dll dlsym
|
# define symbol_from_dll dlsym
|
||||||
|
# define load_dll_error dlerror
|
||||||
# else
|
# else
|
||||||
# define load_dll vimLoadLib
|
# define load_dll vimLoadLib
|
||||||
# define close_dll FreeLibrary
|
# define close_dll FreeLibrary
|
||||||
# define symbol_from_dll GetProcAddress
|
# define symbol_from_dll GetProcAddress
|
||||||
|
# define load_dll_error GetWin32Error
|
||||||
# endif
|
# endif
|
||||||
/*
|
/*
|
||||||
* Wrapper defines
|
* Wrapper defines
|
||||||
@ -795,7 +797,7 @@ py3_runtime_link_init(char *libname, int verbose)
|
|||||||
if (!hinstPy3)
|
if (!hinstPy3)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
semsg(_(e_loadlib), libname);
|
semsg(_(e_loadlib), libname, load_dll_error());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +184,13 @@
|
|||||||
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
||||||
# define symbol_from_dll dlsym
|
# define symbol_from_dll dlsym
|
||||||
# define close_dll dlclose
|
# define close_dll dlclose
|
||||||
|
# define load_dll_error dlerror
|
||||||
# else
|
# else
|
||||||
# define RUBY_PROC FARPROC
|
# define RUBY_PROC FARPROC
|
||||||
# define load_dll vimLoadLib
|
# define load_dll vimLoadLib
|
||||||
# define symbol_from_dll GetProcAddress
|
# define symbol_from_dll GetProcAddress
|
||||||
# define close_dll FreeLibrary
|
# define close_dll FreeLibrary
|
||||||
|
# define load_dll_error GetWin32Error
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -806,7 +808,7 @@ ruby_runtime_link_init(char *libname, int verbose)
|
|||||||
if (!hinstRuby)
|
if (!hinstRuby)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
semsg(_(e_loadlib), libname);
|
semsg(_(e_loadlib), libname, load_dll_error());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,11 +167,13 @@ typedef int HANDLE;
|
|||||||
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
||||||
# define symbol_from_dll dlsym
|
# define symbol_from_dll dlsym
|
||||||
# define close_dll dlclose
|
# define close_dll dlclose
|
||||||
|
# define load_dll_error dlerror
|
||||||
# else
|
# else
|
||||||
# define TCL_PROC FARPROC
|
# define TCL_PROC FARPROC
|
||||||
# define load_dll vimLoadLib
|
# define load_dll vimLoadLib
|
||||||
# define symbol_from_dll GetProcAddress
|
# define symbol_from_dll GetProcAddress
|
||||||
# define close_dll FreeLibrary
|
# define close_dll FreeLibrary
|
||||||
|
# define load_dll_error GetWin32Error
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -213,7 +215,7 @@ tcl_runtime_link_init(char *libname, int verbose)
|
|||||||
if (!(hTclLib = load_dll(libname)))
|
if (!(hTclLib = load_dll(libname)))
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
semsg(_(e_loadlib), libname);
|
semsg(_(e_loadlib), libname, load_dll_error());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
for (i = 0; tcl_funcname_table[i].ptr; ++i)
|
for (i = 0; tcl_funcname_table[i].ptr; ++i)
|
||||||
|
@ -4902,7 +4902,8 @@ iconv_enabled(int verbose)
|
|||||||
{
|
{
|
||||||
verbose_enter();
|
verbose_enter();
|
||||||
semsg(_(e_loadlib),
|
semsg(_(e_loadlib),
|
||||||
hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL);
|
hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL,
|
||||||
|
GetWin32Error());
|
||||||
verbose_leave();
|
verbose_leave();
|
||||||
}
|
}
|
||||||
iconv_end();
|
iconv_end();
|
||||||
|
@ -716,7 +716,7 @@ dyn_libintl_init(void)
|
|||||||
if (p_verbose > 0)
|
if (p_verbose > 0)
|
||||||
{
|
{
|
||||||
verbose_enter();
|
verbose_enter();
|
||||||
semsg(_(e_loadlib), GETTEXT_DLL);
|
semsg(_(e_loadlib), GETTEXT_DLL, GetWin32Error());
|
||||||
verbose_leave();
|
verbose_leave();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -8353,3 +8353,19 @@ resize_console_buf(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#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;
|
||||||
|
}
|
||||||
|
@ -83,4 +83,5 @@ int get_conpty_type(void);
|
|||||||
int is_conpty_stable(void);
|
int is_conpty_stable(void);
|
||||||
int get_conpty_fix_type(void);
|
int get_conpty_fix_type(void);
|
||||||
void resize_console_buf(void);
|
void resize_console_buf(void);
|
||||||
|
char * GetWin32Error(void);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
@ -6862,8 +6862,9 @@ dyn_winpty_init(int verbose)
|
|||||||
if (!hWinPtyDLL)
|
if (!hWinPtyDLL)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
semsg(_(e_loadlib), *p_winptydll != NUL ? p_winptydll
|
semsg(_(e_loadlib),
|
||||||
: (char_u *)WINPTY_DLL);
|
(*p_winptydll != NUL ? p_winptydll : (char_u *)WINPTY_DLL),
|
||||||
|
GetWin32Error());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
for (i = 0; winpty_entry[i].name != NULL
|
for (i = 0; winpty_entry[i].name != NULL
|
||||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3208,
|
||||||
/**/
|
/**/
|
||||||
3207,
|
3207,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user