New headers needed for compiling the Python bindings module#22
New headers needed for compiling the Python bindings module#22mindflayer wants to merge 1 commit intotidwall:mainfrom
Conversation
|
@tidwall do you expect me to add some tests here? I am not really a C expert. |
|
In this case, I don't think additional tests are needed for adding these typedefs. But I'm wondering if this can be fixed on the python/cython side rather than adding a typedef to the tg.h file. Maybe in the pxd or pyx file, there's a way to add the 'struct' keyword to tg_rect and tg_geom definitions? I admit I'm not super knowledgable with cython, but perhaps is possible to change |
This is what I currently have: # cython: language_level=3
cdef extern from "tg.h":
ctypedef struct tg_geom:
pass
ctypedef struct tg_point:
double x
double y
ctypedef struct tg_rect:
tg_point min
tg_point max
...I assume that Cython needs to find the headers on the other side, but I am also not an expert. |
|
Try changing ctypdef to cdef. cdef extern from "tg.h":
cdef struct tg_geom:
pass
cdef struct tg_point:
double x
double y
cdef struct tg_rect:
tg_point min
tg_point max |
That made it compile with no need for the changes. Many thanks! |
|
You're very welcome :) |
Please do not open a pull request without first filing an issue and/or discussing the feature directly with me.
Please ensure you adhere to every item in this list
Describe your changes
I need these two lines to be able to generate the Python bindings
Please provide detailed description of the changes.
Those fix the two errors I share here:
Issue number and link
Fix for #8
Pull request require a prior issue with discussion.
Include the issue number of link here.