"
` ` `
The 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
` ` `
How do the referenced?
CodePudding user response:
Because of the new type of cell in the class statement itself is not available, in ctypes, we can in the class statement after class definition cell and set properties _fields_Such written
# refactoring struct list_head structure
Start a new line (+ pass definition)
The class list_head (ctypes. Structure) :
Pass
List_head. _fields_=[(" next ", POINTER (list_head)), (" prev ", POINTER (list_head)]
CodePudding user response:
https://blog.csdn.net/nb_zsy/article/details/104836310