-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCython.txt
More file actions
50 lines (27 loc) · 1.15 KB
/
Cython.txt
File metadata and controls
50 lines (27 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
pass C++ class as parameter http://stackoverflow.com/questions/10436837/cython-and-c-class-constructors
#configparams.pxd
cdef extern from "configparams.h":
cppclass ConfigParams:
ConfigParams(int par1)
int getPar1()
cdef class PyConfigParams:
cdef ConfigParams* thisptr
# session.pyx
from configparams cimport PyConfigParams
from cython.operator cimport dereference as deref
cdef class PySession:
cdef Session* thisptr
def __cinit__(self, PyConfigParams pars):
self.thisptr = new Session(deref(pars.thisptr))
def doSomething(self):
self.thisptr.doSomething()
Cython package hierarchy https://groups.google.com/forum/#!msg/cython-users/6trL0V1bLx4/7bxhj0xCK50J
cdef class samplerCaller:
cdef np.float64_t v_pos[3]
results in bizarre error:
carray.from_py:77:51: 'float64_t' is not a type identifier
collect weird Cython error messages to present to THW
see also causesError.pyx, I think I might have another version at home
see also Cython.txt at home
http://www.thehackerwithin.org/berkeley/posts/cython-python-c-api/
a public declaration is only needed to make it accessible to external C code.