How to pass arguments by reference from c++ to python with pybind11? #3991
Unanswered
leonleeann
asked this question in
Q&A
Replies: 2 comments
-
Did you ever find an answer to this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Encountered this issue as well. Passing a pointer works well but references throw an exception. Any progress here? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using PyBind11 to run a Python interpreter, and I need to call a Python function in c++ with some pointer arguments.
It looks like that a argument being passed to Python side should be freed normally by the Python interpreter, instead of the c++ main program.
But this time my argument is a pointer to a static object, it should NOT be freed by anyone.
I know that
pybind11::return_value_policy::reference
can be used to prevent a returning result from being freed, but it is for a returning object, not for arguments.How to code such a binding/calling?
Beta Was this translation helpful? Give feedback.
All reactions