Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[BUGFIX]fix python 3.8 ctypes dll load with windows #19236

Merged
merged 1 commit into from
Oct 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion python/mxnet/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,12 @@ class MXCallbackList(ctypes.Structure):
def _load_lib():
"""Load library by searching possible path."""
lib_path = libinfo.find_lib_path()
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
if sys.version_info >= (3, 8) and os.name == "nt":
# use LOAD_WITH_ALTERED_SEARCH_PATH, For simplicity, let's just fill the numbers.
# pylint: disable=E1123
lib = ctypes.CDLL(lib_path[0], winmode=0x00000008)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the magic value available as a constant somewhere?

Copy link
Contributor Author

@yajiedesign yajiedesign Sep 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at the moment.So I added some comments.

else:
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
# DMatrix functions
lib.MXGetLastError.restype = ctypes.c_char_p
return lib
Expand Down