File: const_T42.srctree

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (30 lines) | stat: -rw-r--r-- 652 bytes parent folder | download | duplicates (10)
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
# tag: cpp
PYTHON setup.py build_ext --inplace
PYTHON -c "import test"

######## test.pyx ########
# distutils: language = c++

cdef extern from "test.h":
    ctypedef struct c_Test "Test":
        const char *getString() except +RuntimeError

cdef class Test:
    cdef c_Test *thisptr
    def getString(self):
        return self.thisptr.getString()

######## test.h ########

static const char *astring = "123";
class Test {
public:
    const char *getString(void) { return astring; }
};

######## setup.py ########

from distutils.core import setup
from Cython.Build.Dependencies import cythonize

setup(name='test', ext_modules=cythonize('*.pyx'))