Replies: 4 comments 3 replies
-
@jwuttke the
-- this might help: https://pybind11.readthedocs.io/en/stable/advanced/pycpp/numpy.html |
Beta Was this translation helpful? Give feedback.
-
Here my own minimal example, which does not work: src.h:
Bindables.hpp:
CMakeLists.txt:
Result:
|
Beta Was this translation helpful? Give feedback.
-
re your example: this will indeed not work: in order to bind any non-primitive type Binder need its full definition. So in this case since no full definition was provided binding generation for any functions that take/return re my example: - i just included #include <Python.h>
PyObject * py_object_test() { return new PyObject(); } |
Beta Was this translation helpful? Give feedback.
-
I am not sure what do you mean by "work" but if intention was to create Python types inside function and bind such function then no, - i do not think that will work. Unless i am mistaken instead the Pybind11 However, I would not recommend to bind such functions but instead provide them as custom-binders or add-on-binders for given classes or namespaces. Please see |
Beta Was this translation helpful? Give feedback.
-
A class member function that returns a PyObject* is not binded. If the return type is changed to void*, it is (but my Python application will segfault).
I found no single occurrence of "PyObject" in the Binder sources. So where does this exception come from?
Are there other ways to return a Numpy array?
Beta Was this translation helpful? Give feedback.
All reactions