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

Commit

Permalink
fix python 3.8 ctypes dll load with windows (#19236)
Browse files Browse the repository at this point in the history
  • Loading branch information
yajiedesign authored Oct 1, 2020
1 parent 9de2a48 commit 464608c
Showing 1 changed file with 6 additions and 1 deletion.
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)
else:
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
# DMatrix functions
lib.MXGetLastError.restype = ctypes.c_char_p
return lib
Expand Down

0 comments on commit 464608c

Please sign in to comment.