Reputation: 8596
I'm trying to use a C struct in Cython, that defines a linked list:
typedef struct {
struct query_result* next_result;
char* result;
} query_result;
As you can see I'm using the query_result type inside its own definition. Using this as is, in Cython gives me compiler errors:
cdef extern from 'c_wrapper.h':
struct query_result:
struct query_result*
char*
Any ideas about how to properly handle this recursive definition in Cython?
Upvotes: 2
Views: 936
Reputation: 229784
You shouldn't use the struct
keyword when you are referring to the type:
cdef extern from 'c_wrapper.h':
struct query_result:
query_result* more
char* data
Upvotes: 6