Skip to content

Tag: pybind11

How to set python function as callback for c++ using pybind11?

It is from SDK which I can call the client from dynamic library in c++ codes. I want to port it to python bindings use pybind11. How do I set_callback in python? I have seen the doc and try: The code just failed to compile. My question, how do I convert the py::function to ftype_callback or there is other way

pybind11 modify numpy array from C++

EDIT: It works now, I do not know why. Don’t think I changed anything I want to pass in and modify a large numpy array with pybind11. Because it’s large I want to avoid copying it and returning a new one. Here’s the code: I think the py::array::forcecast is causing a conversion and so leavin…