-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Can't bind functions taking char& as an argument #1116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm away for a couple days and won't be able to look into this in detail until I get back, but one quick question: did it work in 2.1? |
It certainly worked before i merged last Pybind11 upstream... but it am not sure if it was after 2.1 or before it. However i can tell you exact commit where it was still working: it is Dec 16, 2016 RosettaCommons@1d1f81b Thank you! |
Small update: it looks like returning |
@jagerman are there any unexpected complication with this? Should i plan to implement work around for this for now? |
This changes the caster to return a reference to a (new) local `CharT` type caster member so that binding lvalue-reference char arguments works (currently it results in a compilation failure). Fixes pybind#1116
See #1128; that should fix it. |
Great, thank you @jagerman ! |
Just letting you know that i tested this and it works fine, - thanks again! |
In case this is related, in a C++ library I am trying to wrap I get a compilation error with some character inputs. This reproduces the error on MSVC with both the pybind11 master and the branch for this fix: #include <pybind11\pybind11.h>
namespace py = pybind11;
typedef const char* TheString;
void TheMethod(TheString& theString) {};
PYBIND11_MODULE(pymod2, mod) {
mod.def("TheMethod", (void (*) (TheString &)) &TheMethod);
} results in
|
This changes the caster to return a reference to a (new) local `CharT` type caster member so that binding lvalue-reference char arguments works (currently it results in a compilation failure). Fixes #1116
@jagerman Done. Thanks for the support. |
This changes the caster to return a reference to a (new) local `CharT` type caster member so that binding lvalue-reference char arguments works (currently it results in a compilation failure). Fixes pybind#1116
This changes the caster to return a reference to a (new) local `CharT` type caster member so that binding lvalue-reference char arguments works (currently it results in a compilation failure). Fixes #1116
Hello @jagerman,
|
Dear Pybind11 developers,
Looks like both latest
master
andstable
seems to produce an error when trying to bind function takingchar &
. Could you please looks this up?Thanks,
Error:
The text was updated successfully, but these errors were encountered: