opaque types, constructors, assignment - help please

Jose Nazario <[email protected]> Thu, 25 Feb 2010 12:04:07 -0500 (EST)
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
hello

long time user of pyrex, first time posting to the list. not the strongest =

programmer, either, so this may be easy to solve and i just don't know it.

platform:

 	- Python 2.5
 	- Pyrex 0.9.8.5
 	- gcc-4.2
 	- FreeBSD 7.0-release (on amd64)

working with FastBit, specifically it's C API:

 	http://crd.lbl.gov/~kewu/fastbit/doc/html/group__FastBitCAPI.html

trying to get the following code to work:

cdef extern from "../src/capi.h":
     ctypedef extern struct FastBitQueryHandle
     ....
     FastBitQueryHandle fastbit_build_query(char *selectClause, char =

*indexLocation, char *queryConditions)
     ....

class Query:
     # The Query class holds queries over the FastBit data set
     def __init__(self, selectClause, indexLocation, queryConditions):
         self.qh =3D <FastBitQueryHandle>fastbit_build_query(selectClause,
                     indexLocation, queryConditions)

not surprisingly i get an assignment error:

/var/home/jose/fastbit-ibis1.1.6/python/fastbit.pyx:235:18: Cannot convert =

'FastBitQueryHandle' to Python object


FastBitQueryHandle is a complex C++ object, easier to leave it opaque (and =

left opaque in the capi.h header, too).

the complete pyx code is up here:

 	http://monkey.org/~jose/tmp/fastbit.pyx

i've tried a few things trying to get it to assign, sometimes it will tell =

me that it can't assign because it's an incomplete type. (same thing =

happens in the ResultSet assignment).

any help in getting this building is appreciated, thanks.

________
jose nazario, ph.d.		    http://monkey.org/~jose/