UPDATE Minimal example on GitHub: https://github.com/wl2776/cython_error
I've got a C library, that I want to access from Python. I'm developing a Cython wrappers for it.
The library has following declarations:
file "globals.h"
typedef struct
{
int x;
int y;
int radius;
} circleData;
file "O_Recognition.h"
#include "globals.h"
typedef struct
{
int obj_count;
circleData circle_data[2];
float parameters[2];
} objectData;
I'm mapping these types to Cython in .pxd file, as follows:
file "cO_Recognition.pxd":
cdef extern from "globals.h":
ctypedef struct circleData:
int x;
int y;
int radius;
cdef extern from "O_Recognition.h":
ctypedef struct objectData:
int obj_count;
circleData circle_data[2];
float parameters[2];
And this does not compile. I am getting errors:
Error compiling Cython file:
------------------------------------------------------------
...
void PyTuple_SET_ITEM(object p, Py_ssize_t pos, object o)
void PyList_SET_ITEM(object p, Py_ssize_t pos, object o)
@cname("__Pyx_carray_to_py_circleData")
cdef inline list __Pyx_carray_to_py_circleData(circleData *v, Py_ssize_t length):
^
------------------------------------------------------------
carray.to_py:112:45 'circleData' is not a type identifier
One more detail, this is a part of the CMake project, that is built using this example from GitHub: https://github.com/thewtex/cython-cmake-example
Relevant part of CMakeLists.txt includes .pyx file with other name, that cimports this cDeclarations.pxd