fengda 发表于 2017-4-30 07:39:22

Python中调用动态连接库

  使用Python中的ctypes库可以调用动态链接库,windows和linux平台下代码如下:
  windows:调用tt.dll
  from ctypes import *
  tt = CDLL("tt.dll")
  print tt.getvalue()
  linux:调用tt.so
  from ctypes import *
  tt = CDLL("./tt.so")
  print tt.getvalue()
  上面两端代码基本相似,只是CDLL中的路径有所不同。不论linux和windows平台,只要将动态链接库放在搜索路径上即可 
页: [1]
查看完整版本: Python中调用动态连接库