python3 ctypes 的 结构体定义中,怎么引用自身?
我这么使用时提示说“找不到Sentence_link”
```
class Sentence_link(ctypes.Structure):
_fields_= [("para_idx", ctypes.c_ulong), ("sent_idx", ctypes.c_ulong),("sent_init",ctypes.c_int),("msg_buff",ctypes.c_char_p), ("next",ctypes.POINTER(Sentence_link))]
```
```
_fields_= [("para_idx", ctypes.c_ulong), ("sent_idx", ctypes.c_ulong),("sent_init",ctypes.c_int),("msg_buff",ctypes.c_char_p), ("next",ctypes.POINTER(Sentence_link))]
NameError: name 'Sentence_link' is not defined
```
请问该如何引用自身?
```
class Sentence_link(ctypes.Structure):
_fields_= [("para_idx", ctypes.c_ulong), ("sent_idx", ctypes.c_ulong),("sent_init",ctypes.c_int),("msg_buff",ctypes.c_char_p), ("next",ctypes.POINTER(Sentence_link))]
```
```
_fields_= [("para_idx", ctypes.c_ulong), ("sent_idx", ctypes.c_ulong),("sent_init",ctypes.c_int),("msg_buff",ctypes.c_char_p), ("next",ctypes.POINTER(Sentence_link))]
NameError: name 'Sentence_link' is not defined
```
请问该如何引用自身?
...全文
相关推荐
python ctypes模块
例如,在 Python 中可以这样定义:```pythonfrom ctypes import *# 定义 C 语言的数据类型class xvid_gbl_info_t(Structure): _fields
ctypes库的使用 python调用Windows DLL
;```我们可以使用 ctypes 中的 `Structure` 类来定义一个对应的 Python 结构体:```pythonclass stBPDynamicData(Structure): _fields
python 结构体 引用自身
使用PYTHON编写的 结构体应用例子, 引用自身,非常不错的一个示例程序,
使用Python向C语言的链接库传递数组、结构体、指针类型的数据
"这篇文章主要讲解如何使用Python的ctypes库向C语言的链接库传递数组、结构体和指针类型的数据。"在Python中调用C语言编写的库时,ctypes库是一个非常实用的工具。它允许我们直接
python3利用ctypes传入一个字符串类型的列表方法
### Python3 使用 ctypes 传递字符串列表到 C 语言在跨语言编程中,有时我们需要让 Python 调用 C 语言编写的库或函数。


工具平台和程序库
