Cython递归结构声明

dee*_*lue 1 cython

我正在尝试在Cython中使用C结构,它定义了一个链表:

typedef struct {  
    struct query_result* next_result;  
    char*                result;   
} query_result;
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我在自己的定义中使用了query_result类型.按原样使用,在Cython中给出了编译器错误:

cdef extern from 'c_wrapper.h':  
    struct query_result:  
        struct query_result* 
        char*
Run Code Online (Sandbox Code Playgroud)

关于如何在Cython中正确处理这个递归定义的任何想法?

sth*_*sth 5

struct在引用类型时,不应使用关键字:

cdef extern from 'c_wrapper.h':  
    struct query_result:  
        query_result* more
        char* data
Run Code Online (Sandbox Code Playgroud)