Cython中的嵌套结构

时间:2015-11-21 03:05:07

标签: python cython python-c-extension

我希望得到一些帮助,声明并使用Cython的嵌套结构类型。在sqlite3.h头文件中,有:

struct sqlite3_index_info {
  int nConstraint;           /* Number of entries in aConstraint */

  struct sqlite3_index_constraint {
     int iColumn;              /* Column on left-hand side of constraint */
     unsigned char op;         /* Constraint operator */
     unsigned char usable;     /* True if this constraint is usable */
     int iTermOffset;          /* Used internally - xBestIndex should ignore */
  } *aConstraint;            /* Table of WHERE clause constraints */
  ... more members ...
}

这是唯一宣布sqlite3_index_constraint的地方。

在SQLite的作者提供的示例C库中,使用了这些结构:

 const struct sqlite3_index_constraint *pConstraint;
 pConstraint = pIdxInfo->aConstraint;

我试图声明" sqlite3_index_constraint"分开,所以我有:

const struct sqlite3_index_constraint *pConstraint; 
pConstraint = pIdxInfo->aConstraint;

在我的代码中,我尝试cdef sqlite3_index_constraint *pConstraint并进行cythonizes,但无法编译:

error: unknown type name ‘sqlite3_index_constraint’

0 个答案:

没有答案