Improve error handling when loading DLLs
This commit is contained in:
parent
b9e10203bd
commit
d67332dc19
15
C/load_dll.c
Normal file → Executable file
15
C/load_dll.c
Normal file → Executable file
@ -47,13 +47,18 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
|
|
||||||
if (Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE) &&
|
if (Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE) &&
|
||||||
(handle=LoadLibrary(Yap_FileNameBuf)) != 0)
|
(handle=LoadLibrary(Yap_FileNameBuf)) != 0)
|
||||||
{
|
{
|
||||||
if (*init_proc == NULL)
|
Yap_ErrorSay[0]=~'\0';
|
||||||
*init_proc = (YapInitProc)GetProcAddress((HMODULE)handle, proc_name);
|
if (*init_proc == NULL)
|
||||||
}
|
*init_proc = (YapInitProc)GetProcAddress((HMODULE)handle, proc_name);
|
||||||
|
} else {
|
||||||
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
|
NULL, GetLastError(),
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), Yap_ErrorSay, 256,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
ofiles = ofiles->next;
|
ofiles = ofiles->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load libraries first so that their symbols are available to
|
/* load libraries first so that their symbols are available to
|
||||||
other routines */
|
other routines */
|
||||||
while (libs) {
|
while (libs) {
|
||||||
|
0
C/load_foreign.c
Normal file → Executable file
0
C/load_foreign.c
Normal file → Executable file
Reference in New Issue
Block a user