Skip to content

Commit

Permalink
fix python 3.8 ctypes dll load with windows (apache#19236)
Browse files Browse the repository at this point in the history
  • Loading branch information
yajiedesign authored and josephevans committed Oct 19, 2021
1 parent cdc4c7a commit 55c4d5c
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 @@ -339,7 +339,12 @@ def classproperty(func):
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 55c4d5c

Please sign in to comment.