File tree Expand file tree Collapse file tree 1 file changed +3
-29
lines changed
Expand file tree Collapse file tree 1 file changed +3
-29
lines changed Original file line number Diff line number Diff line change 11import os
2- import platform
32
43from ctypes import cdll
54from ctypes import CDLL
98from ctypes import c_int , c_uint , c_void_p , c_char_p
109
1110
12- def LoadLibrary (
13- file_name : str , base_dir : str = os .path .dirname (os .path .abspath (__file__ ))
14- ) -> CDLL :
15- try :
16- file_path = os .path .join (base_dir , "bin" , file_name )
17- msc = cdll .LoadLibrary (file_path )
18- except Exception as e :
19- raise Exception ("Failed to load library: %s" % e )
20- return msc
21-
22-
2311def LoadMSC () -> CDLL :
24- system = platform .system ()
25- arch = platform .architecture ()[0 ]
26-
27- if system == "Windows" :
28- if arch == "64bit" :
29- msc = LoadLibrary ("msc_x64.dll" )
30- else :
31- msc = LoadLibrary ("msc_x86.dll" )
32- elif system == "Linux" :
33- if arch == "64bit" :
34- msc = LoadLibrary ("msc_x64.so" )
35- else :
36- msc = LoadLibrary ("msc_x86.so" )
37- else :
38- raise Exception ("Unsupported system: %s" % system )
39- return msc
40-
12+ name = os .getenv ('MSC_SDK_PATH' )
13+ assert name is not None , 'MSC_SDK_PATH is not set.'
14+ return cdll .LoadLibrary (name )
4115
4216msc = LoadMSC ()
4317
You can’t perform that action at this time.
0 commit comments