Skip to content

Commit 3ae4c7b

Browse files
author
Han Sangjin
committed
[stdlib] Fixed image inspection for Win32
Removed calling FreeLibrary(). See GetModuleHandle function in MSDN.
1 parent 058d7f6 commit 3ae4c7b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/public/runtime/ImageInspectionWin32.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,10 @@ static int _addImageCallback(struct _swift_dl_phdr_info *info,
185185
if (conformances)
186186
inspectArgs->fnAddImageBlock(conformances, conformancesSize);
187187

188-
#if defined(_WIN32)
189-
FreeLibrary(handle);
190-
#else
188+
// There is no close function or free function for GetModuleHandle(),
189+
// especially we should not pass a handle returned by GetModuleHandle to the
190+
// FreeLibrary function.
191+
#if defined(__CYGWIN__)
191192
dlclose(handle);
192193
#endif
193194
return 0;

0 commit comments

Comments
 (0)