summaryrefslogtreecommitdiff
path: root/weave/examples/support_code_example.py
blob: 713871a55400127f066afd27e7161e8efd39e025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sys
sys.path.insert(0,'..')
import inline_tools


support_code = """
               PyObject* length(Py::String a)
               {
                   int l = a.length();
                   return Py::new_reference_to(Py::Int(l));
               }
               """
a='some string'
val = inline_tools.inline("return_val = length(a);",['a'],
                          support_code=support_code)
print val