承接国内外服务器租用托管、定制开发、网站代运营、网站seo优化托管接单、网站代更新,新老站点皆可!!咨询QQ:3787320601

python怎样调用dll库中的函数

管理员 2023-03-27 09:53:48 互联网圈 84 ℃ 0 评论 872字 收藏

python怎样调用dll库中的函数

python如何调用dll库中的函数

在python中使用ctypes模块调用dll库中函数的方法

1.首先,在Python项目中引入ctypes模块;

from ctypes import *

2.ctypes模块引入后,在Python中加载dll库;

Objdll = ctypes.WinDLL("dllpath")

3.最后,dll库加载好后,通过以下方法便可调用dll库中的函数;

strDllPath = sys.path[0] + str(os.sep) + "createguid.dll"

dll = CDLL(strDllPath)

b = dll.newGUID()

a = c_char_p(b)

except Exception, error:

print error

return ""

return a.value

文章来源:丸子建站

文章标题:python怎样调用dll库中的函数

https://www.wanzijz.com/view/4573.html

TAG: python dll库

相关文章

Related articles

X

截屏,微信识别二维码

微信号:weimawl

(点击微信号复制,添加好友)

打开微信