cname = None, visibility = 'extern', defining = 0,
api = 0, in_pxd = 0, modifiers = ()):
if name == self.name.split('::')[-1] and cname is None:
+ self.check_base_default_constructor(pos)
name = '<init>'
+ type.return_type = self.lookup(self.name).type
prev_entry = self.lookup_here(name)
entry = self.declare_var(name, type, pos, cname, visibility)
if prev_entry:
finally:
del pair
- cdef Wrap[int*] *w
+def test_ptr(int i):
+ """
+ >>> test_ptr(3)
+ 3
+ >>> test_ptr(5)
+ 5
+ """
+ try:
+ w = new Wrap[int*](&i)
+ return deref(w.get())
+ finally:
+ del w
+
+cdef double f(double x):
+ return x*x
- cdef Wrap[double (*)(double)] *w
+def test_func_ptr(double x):
+ """
+ >>> test_func_ptr(3)
+ 9.0
+ >>> test_func_ptr(-1.5)
+ 2.25
+ """
+ try:
+ w = new Wrap[double (*)(double)](&f)
+ return w.get()(x)
+ finally:
+ del w