为带有类型提示的共享库构建cTypes接口
ctyped的Python项目详细描述
https://github.com/idlesign/ctyped
说明
为带有类型提示的共享库构建cTypes接口
需要python 3.6+
- 更少的样板文件;
- 逻辑结构;
- 有用的助手。
fromctyped.toolboximportLibrary# Define library.lib=Library('mylib.so')@lib.structureclassBox:one:inttwo:str# Type less with function names prefixes.withlib.scope(prefix='mylib_'):# Describe function available in the library.@lib.functiondefsome_func(title:str,year:int,box:Box)->str:...# Bind ctype types to functions available in the library.lib.bind_types()# Call library function.result_string=some_func('Hello!',2019,Box(one=35,two='dummy'))
阅读文档了解更多信息。