python 调用dll示例

  • 初始化
 if platform.system().lower() == 'windows':
     path = os.path.dirname(os.path.realpath(__file__))
     file=os.path.join(path,'filedir','functions.dll')
     self.pDll = CDLL(file)
     self.pDll.Init()
     self.pDll.fun.restype = c_char_p
 elif platform.system().lower() == 'linux':
     ll = cdll.LoadLibrary
     self.pDll = ll('./file/functions.so')
     self.pDll.fun.restype = c_char_p
  • 调用
result1 = dll.fun(a)

你可能感兴趣的:(python,json,python)