[C++-sig] Can't get Boost.Python to use extensions generated and wrapped with Py++
Lawrence Spector
Lawrence.Spector at CanfieldSci.com
Tue Jul 17 21:43:46 CEST 2007
Well, I tried to register_ptr_to_python functionality and it seems to work as long as a I make a modification to the class to make the Python exposed "A" also let boost::python know it inherits from boost::noncopyable. However, I noticed it never called the wrapper when done this way. I guess this makes sense, since it actually is an A in this case.
I realized a major part of my problem was the use of Unicode, I think it was causing unpredictable behavior when a Unicode string was passed into Boost.Python. I'll have to go back and try some of the other things that I thought failed for a different reason but where actually failing when I did this:
main_namespace[L"pyTestClass"] = ...; // Note the L
when
main_namespace["pyTestClass"] = ...;
would work.
Hmmm... anyway, I'm going to try to see how far I can get with this.
Thanks for all of your help,
Lawrence
-----Original Message-----
From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org] On Behalf Of Roman Yakovenko
Sent: Tuesday, July 17, 2007 2:15 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] Can't get Boost.Python to use extensions generated and wrapped with Py++
On 7/17/07, Lawrence Spector <Lawrence.Spector at canfieldsci.com> wrote:
> Ok, I've been playing with it some more, still not getting everything to work though. I tried the things you said; it still wasn't working. I took out the constructors from the python interface and added shared_ptr support. I then pass the shared_ptr through. It still doesn't work upon creating the object -- it throws an exception, saying that
there's no converter.
I am not sure why your code doesn't work, try to use
register_ptr_to_python functionality(
http://boost.org/libs/python/doc/v2/register_ptr_to_python.html )
Also did you try boost::ref and boost::python::ptr functionality?
I also suggest you to use google :-)
This is what I get when I searched for "boost.python share C++ instance"
http://wiki.python.org/moin/boost.python/EmbeddingPython
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
_______________________________________________
C++-sig mailing list
C++-sig at python.org
http://mail.python.org/mailman/listinfo/c++-sig
More information about the Cplusplus-sig
mailing list