fixup! http: support lazy-loading libcurl also on Windows

If the `.dll` file could not be loaded, let's print an error message.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2023-08-28 12:18:58 +02:00
parent a2e49ec355
commit b29582706b

View File

@@ -56,8 +56,22 @@ static void *load_library(const char *name)
dll_path[len] = '/';
memcpy(dll_path + len + 1, name, name_size);
if (!access(dll_path, R_OK))
return (void *)LoadLibraryExA(dll_path, NULL, 0);
if (!access(dll_path, R_OK)) {
void *res = (void *)LoadLibraryExA(dll_path, NULL, 0);
if (!res) {
DWORD err = GetLastError();
char buf[1024];
if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ARGUMENT_ARRAY |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, LANG_NEUTRAL,
buf, sizeof(buf) - 1, NULL))
xsnprintf(buf, sizeof(buf), "last error: %ld", err);
error("LoadLibraryExA() failed with: %s", buf);
}
return res;
}
}
path = *sep ? sep + 1 : NULL;