I've seen here that you can do
from libcpp.string cimport string
from libcpp.vector cimport vector
to refer to parameters of type std::string
and std::vector
. I need to pass functions to a c++ method expecting std::function<>
. I tried doing
from libcpp.function cimport function
but that didn't work:
from libcpp.function cimport function
^
------------------------------------------------------------
cython_topics.pyx:3:0: 'libcpp/function/function.pxd' not found
Traceback (most recent call last):
File "setup.py", line 18, in <module>
language="c++", # generate and compile C++ code
File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py", line 934, in cythonize
cythonize_one(*args)
File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py", line 1056, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: cython_topics.pyx
What's the right way to call a c++ function expecting std::function<>
?
Aucun commentaire:
Enregistrer un commentaire