Thank you very much for this hint.
I didn't know about call policy.
I have tested the different policies shown there:
http://wiki.python.org/moin/boost.python/CallPolicy
http://www.boost.org/doc/libs/1_49_0/libs/python/doc/tutorial/doc/html/python/functions.
But all of them produce the same results:
- myC is modified within Python, even after leaving the function
- Python modification is not taken into account in C++ when h call g.
I understand that call policies can be used in a more subtle way, but if you
have any recommended link which is more explicit the the 2 former ones, that
would be very helpful.
Thank you very much in advance.
CHRISTOPHE Jean-Joseph
________________________________
De : Stefan Seefeld <ste...@seefeld.name>
À : cplusplus-sig@python.org
Envoyé le : Vendredi 8 juin 2012 18h16
Objet : Re: [C++-sig] Re : changing argument value in a C++/Python code
Christoph,
your C++ code passes a pointer argument to the "g()" member function,
but your Python bindings don't specify a call policy. (I wonder why that
doesn't raise a compilation error.)
The effect mostly likely is that in fact the value is copied, so you see
a new object.
Explicit is better than implicit.
Stefan
--
...ich hab' noch einen Koffer in Berlin...
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig