[C++-sig] arguments to c++ functions

2011-08-09 Thread Josh Stratton
Where can I find docs for sending arguments to C\C++ functions? I've followed the hello world example, which seems to automatically convert a python string to a char*, but I'm going to need more conversions later like how to handle a char**. Something like ["a","b","c"] doesn't seem to work.

[C++-sig] getting a list of strings from a static method

2011-08-24 Thread Josh Stratton
I'm very new to boost python and trying to figure out how to properly get a list of strings from a static method in my main namespace. I'm not sure if I need to extract the list from the object or if it's already a list. boost::python::object list = exec("Foo.extensions()", _pyMainNamespace); //

[C++-sig] sending a c++ class to a python function

2011-08-28 Thread Josh Stratton
I'm getting an error when I try to pass down my object that results in a seg fault. I've registered my class I'm sending down, but when I actually send it, my program exits at this line in the library right after I call the importFile() function... return call(get_managed_object(self, tag

Re: [C++-sig] sending a c++ class to a python function

2011-08-30 Thread Josh Stratton
would indeed be the way to go, but you'd need to > create a dict and fill it in the convert function. > > Anyhow, my best guess for the segfault is that you have an infinite > recursion - when you call object(scene), it needs to look for a to-python > converter in the regist

Re: [C++-sig] sending a c++ class to a python function

2011-09-01 Thread Josh Stratton
That worked. Thanks. I had trouble getting it to work as a template, so I just removed that portion. //template inline Scene* get_pointer(QSharedPointer const &p) { return p.data(); // or whatever } On Tue, Aug 30, 2011 at 10:57 AM, Jim Bosch wrote: > On 08/30/2011 07:45 A

[C++-sig] copy constructors and multiple instances

2011-09-01 Thread Josh Stratton
In my particular scene I have a Scene class, which operates as kind of a context for my operations and holds all the meshes in the scene. I send my scene down to the python side so import methods will import into the containers in the scene object. For example, addMeshFromFile(scene, fileName) wh

Re: [C++-sig] copy constructors and multiple instances

2011-09-01 Thread Josh Stratton
>> In my particular scene I have a Scene class, which operates as kind of >> a context for my operations and holds all the meshes in the scene.  I >> send my scene down to the python side so import methods will import >> into the containers in the scene object.  For example, >> addMeshFromFile(scen

Re: [C++-sig] copy constructors and multiple instances

2011-09-01 Thread Josh Stratton
ng to send the Scene object down to python. Error in Python: : No to_python (by-value) converter found for C++ type: Scene On Thu, Sep 1, 2011 at 1:52 PM, Jim Bosch wrote: > On 09/01/2011 01:01 PM, Josh Stratton wrote: >>> >>> - I'm a bit confused by your python_binding

Re: [C++-sig] copy constructors and multiple instances

2011-09-02 Thread Josh Stratton
e I haven't touched this part of the code when since I was using QSharedPointers, so I assume there's something I'm still not doing to setup this mapping. On Fri, Sep 2, 2011 at 1:24 AM, Hans Meine wrote: > Am Freitag, 2. September 2011, 04:31:24 schrieb Josh Stratton: >&

Re: [C++-sig] copy constructors and multiple instances

2011-09-02 Thread Josh Stratton
Well, right now I'm just passing "this" from inside the scene object, so does that need to be wrapped in a shared pointer? On Fri, Sep 2, 2011 at 12:19 PM, Dave Abrahams wrote: > > on Thu Sep 01 2011, Jim Bosch wrote: > >> boost::python::register_ptr_to_python< boost::shared_ptr >(); >> >> This

Re: [C++-sig] copy constructors and multiple instances

2011-09-02 Thread Josh Stratton
ret += std::string(": Unparseable Python error: "); } if (traceback_ptr != NULL) { py::handle<> h_tb(traceback_ptr); py::object tb(py::import("traceback")); py::object fmt_tb(tb.attr("format_tb")); py::object t

Re: [C++-sig] copy constructors and multiple instances

2011-09-03 Thread Josh Stratton
t;< perror << std::endl; } } }; typedef boost::shared_ptr SceneP; On Fri, Sep 2, 2011 at 9:08 PM, Dave Abrahams wrote: > > on Fri Sep 02 2011, Josh Stratton wrote: > >> Here's a really short example of what I don't understand.  Basically I >> can