wlav / cppyy

Other
400 stars 41 forks source link

pypy cannot pass function to cpp code while using cppyy? #76

Open dinghao188 opened 2 years ago

dinghao188 commented 2 years ago

i am using pypy+cppyy, and the code is below

import cppyy
cppyy.cppdef("""
void hello(void (*f)()) { f(); }
""")

def hello_from_py():
    print("Hello PyPy")

cppyy.gbl.hello(hello_from_py)

the output is a error,

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'CPPOverload' object expected, got 'function' instead
wlav commented 2 years ago

Yes, I'm afraid the PyPy/_cppyy implementation is rather behind at this point.