8244495: Some jlink tests crash on Windows after JDK-8237750

Fix of 8237750 changed the loading zip library to on-demand loading, on Windows, jlink/jimage still assume that zip has been loaded already. Fix to load zip on not loaded.

Reviewed-by: kbarrett, mchung, dholmes, dcubed
This commit is contained in:
Yumin Qi 2020-05-06 19:43:57 -07:00
parent 6dd8443493
commit 0ef6d1dff5

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -61,7 +61,10 @@ static void* findEntry(const char* name) {
#ifdef WIN32
HMODULE handle = GetModuleHandle("zip.dll");
if (handle == NULL) {
return NULL;
handle = LoadLibrary("zip.dll");
}
if (handle == NULL) {
return NULL;
}
addr = (void*) GetProcAddress(handle, name);
return addr;