typedef struct t_context t_context;
I'm fairly sure this isn't valid C and forward declarations just don't work for typedef struct. Given that, I wouldn't expect it to work in Cython either (although I don't know why you get any specific errors)
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cython-users/3953b77d-ad39-468d-8344-40bd223facd0n%40googlegroups.com.
typedef struct t_context t_context;
I'm fairly sure this isn't valid C and forward declarations just don't work for typedef struct. Given that, I wouldn't expect it to work in Cython either (although I don't know why you get any specific errors)
Here's what it does:
This is commonly used when:
Example usage:
The compiler accepts this because it only needs to know that t_context exists as a struct type to handle pointers to it, even without knowing its size or members yet."
Sorry - you're right. What you can't do is the forward
declaration of a typedef for an unnamed struct e.g. `typedef
struct t_context;` (where the full declaration would be `typedef
struct { ... } t_context;`
Unfortunately I think it's this that you're trying to do in Cython.
Do you actually need the forward declaration in Cython? You
usually don't I think.
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cython-users/b9f38aac-ca23-45cb-88aa-a8389855a7can%40googlegroups.com.
Sorry - you're right. What you can't do is the forward declaration of a typedef for an unnamed struct e.g. `typedef struct t_context;` (where the full declaration would be `typedef struct { ... } t_context;`
Unfortunately I think it's this that you're trying to do in Cython.
Do you actually need the forward declaration in Cython? You usually don't I think.
I've had a bit more of a look at it.
I think the problem is that for Cython `ctypedef struct t_context` (no colon, no pass) is a forward declaration while `ctypedef struct t_context: pass` is a declaration of an empty struct. So it conflicts with your later full declaration.
The error message "Cannot convert 'S *' to Python object" is
pretty unhelpful I agree. That's definitely worth reporting as a
bug and we might be able to improve it.
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cython-users/CAD2RBm2SBDG8kw%2BcgvX4uYpQ3cjV9ihQO%2BJipwYWjEh5ki7OHg%40mail.gmail.com.
I've had a bit more of a look at it.
I think the problem is that for Cython `ctypedef struct t_context` (no colon, no pass) is a forward declaration while `ctypedef struct t_context: pass` is a declaration of an empty struct. So it conflicts with your later full declaration.
The error message "Cannot convert 'S *' to Python object" is pretty unhelpful I agree. That's definitely worth reporting as a bug and we might be able to improve it.