[C++-sig] Using C++ classes exposed by other modules
Jim Bosch
talljimbo at gmail.com
Tue Oct 19 20:04:03 CEST 2010
On 10/19/2010 05:10 AM, Nat Linden wrote:
> On Thu, Oct 14, 2010 at 1:17 PM, Bryant Gipson <gipson_b at yahoo.com
> <mailto:gipson_b at yahoo.com>> wrote:
>
> C++:
>
> void mySlightlyHelpfulFunction(cppmodule::A &a)
> {
> ...
> }
>
> Python:
> a = mod.A()
> myModule.mySlightlyHelpfulFunction(a)
> myModule.mySlightlyHelpfulFunction(A)
> did not match C++ signature:
> mySlightlyHelpfulFunction(mod::A {lvalue})
>
>
> Just a guess, but would declaring it as:
>
> void mySlightlyHelpfulFunction(const cppmodule::A &a)
>
> work better? (Note insertion of "const")
>
> The {lvalue} in the signature output suggests that the problem could be
> that Boost.Python is internally constructing a C++ temporary
> cppmodule::A value and trying to pass it into mySlightlyHelpfulFunction().
>
That would help in other, similar, similar cases, but wasn't the problem
here.
The OP replied off-line; he was simply linking to the wrong Boost.Python
library. Sorry I neglected to pass it on to the list!
Jim
More information about the Cplusplus-sig
mailing list