Re: [C++-sig] Function handling with Boost

2009-06-23 Thread Christopher Schramm
Stefan Seefeld wrote: > An alternative is not to use BOOST_PYTHON_MODULE at all, but set up > converters in ordinary C++ code. In the following I set up a Python > interpreter in my main application, inject a (C++) base class, run a > Python script that adds a derived class, then instantiate and ru

Re: [C++-sig] Pybindgen/pygccxml integration

2009-06-23 Thread Gustavo Carneiro
2009/6/23 Ben Fitzpatrick > Gustavo Carneiro wrote: > >> >> >> 2009/6/23 Ben Fitzpatrick > bfitzpatr...@vtiinstruments.com>> >> >>Thanks for the suggestions! >> >>I tried the first one, just as a test. I'd like to do the second >>programatically if I can, but I just wanted to make sur

Re: [C++-sig] Function handling with Boost

2009-06-23 Thread Stefan Seefeld
On 06/23/2009 04:43 PM, Christopher Schramm wrote: Stefan Seefeld wrote: You need a module into which to inject the symbols you export. That is true no matter the (meta)type of what you export, i.e. classes, functions, etc. Once you have that module set up (via BOOST_PYTHON_MODULE), you can

Re: [C++-sig] Function handling with Boost

2009-06-23 Thread Christopher Schramm
Stefan Seefeld wrote: > You need a module into which to inject the symbols you export. That is > true no matter the (meta)type of what you export, i.e. classes, > functions, etc. > Once you have that module set up (via BOOST_PYTHON_MODULE), you can > instantiate the newly created Python objects (ty

Re: [C++-sig] Function handling with Boost

2009-06-23 Thread Stefan Seefeld
On 06/23/2009 04:03 PM, Christopher Schramm wrote: Stefan Seefeld wrote: I read your original mail, but I didn't understand what you are trying to achieve. You certainly can export functions to python: void foo(...); ... bpl::def("foo", foo); works just fine. There shouldn't be any need

Re: [C++-sig] Function handling with Boost

2009-06-23 Thread Christopher Schramm
Stefan Seefeld wrote: > I read your original mail, but I didn't understand what you are trying > to achieve. You certainly can export functions to python: > > void foo(...); > > ... > > bpl::def("foo", foo); > > > works just fine. There shouldn't be any need to wrap the function in a > class (

Re: [C++-sig] boost::python on Linux

2009-06-23 Thread Jim Treadway
On Tue, Jun 23, 2009 at 12:06 PM, Stefan Seefeld wrote: > On 06/23/2009 02:45 PM, Jim Treadway wrote: > >> I'm having trouble getting a simple boost::python sample program to >> work properly on Linux. It compiles and seems to link properly, but the >> Python >> interpreter is unable to call my C

Re: [C++-sig] Pybindgen/pygccxml integration

2009-06-23 Thread Ben Fitzpatrick
Gustavo Carneiro wrote: 2009/6/23 Ben Fitzpatrick > Thanks for the suggestions! I tried the first one, just as a test. I'd like to do the second programatically if I can, but I just wanted to make sure annotations were going to fix this

Re: [C++-sig] Passing a c++ new'ed object back to python

2009-06-23 Thread Stefan Seefeld
On 06/23/2009 02:59 PM, Simon Pickles wrote: When I use code which parallels this structure, I see the Model destructor is called when the c++ object goes out of scope (fine) despite the object being passed to python as the argument of a function (not fine!) That is because by default argum

Re: [C++-sig] boost::python on Linux

2009-06-23 Thread Stefan Seefeld
On 06/23/2009 02:45 PM, Jim Treadway wrote: I'm having trouble getting a simple boost::python sample program to work properly on Linux. It compiles and seems to link properly, but the Python interpreter is unable to call my C++ function. On Mac OS X the program works as expected. Any help woul

Re: [C++-sig] Pybindgen/pygccxml integration

2009-06-23 Thread Gustavo Carneiro
2009/6/23 Ben Fitzpatrick > Thanks for the suggestions! > > I tried the first one, just as a test. I'd like to do the second > programatically if I can, but I just wanted to make sure annotations were > going to fix this. It still seems to be giving me the same error: > (...)/pure_virtual.h:5: Wr

[C++-sig] Passing a c++ new'ed object back to python

2009-06-23 Thread Simon Pickles
Hello again. Here's the setup #python from hybrid import ObjectManager om = ObjectManager() om.PassModel() //cpp class Model { ~Model() { printf("model go boom"); } /* */ }; class ObjectManager { Model* PassModel() { return new Model(); }; }; Whe

[C++-sig] boost::python on Linux

2009-06-23 Thread Jim Treadway
I'm having trouble getting a simple boost::python sample program to work properly on Linux. It compiles and seems to link properly, but the Python interpreter is unable to call my C++ function. On Mac OS X the program works as expected. Any help would be appreciated, hopefully I'm missing someth

Re: [C++-sig] Function handling with Boost

2009-06-23 Thread Stefan Seefeld
On 06/23/2009 02:32 PM, Christopher Schramm wrote: Mmmkay, looks like I found a dirty little workaround: I read your original mail, but I didn't understand what you are trying to achieve. You certainly can export functions to python: void foo(...); ... bpl::def("foo", foo); works jus

Re: [C++-sig] Function handling with Boost

2009-06-23 Thread Christopher Schramm
Mmmkay, looks like I found a dirty little workaround: I put the C++ functions, I want to expose into a dummy class: class Dummy { int f1(str arg1, ... void f2(tuple arg1, ... } And then create a bpy object from it: object tmp = class_("dummy") .def("f1", &Dummy::f1)

Re: [C++-sig] bump.... boost::python and __declspec(align(16))

2009-06-23 Thread Simon Pickles
Stefan Seefeld wrote: On 06/23/2009 02:05 PM, Simon Pickles wrote: Hello all, Sorry to bump this, but i am still unable to resolve my problem described below. The problem doesn't appear to be related to boost.python, or even boost. You may have better luck asking on a more suitable forum.

Re: [C++-sig] bump.... boost::python and __declspec(align(16))

2009-06-23 Thread Stefan Seefeld
On 06/23/2009 02:05 PM, Simon Pickles wrote: Hello all, Sorry to bump this, but i am still unable to resolve my problem described below. The problem doesn't appear to be related to boost.python, or even boost. You may have better luck asking on a more suitable forum. Stefan --

[C++-sig] bump.... boost::python and __declspec(align(16))

2009-06-23 Thread Simon Pickles
Hello all, Sorry to bump this, but i am still unable to resolve my problem described below. I have seen a 2008 thread on this: http://archives.free.net.ph/message/20080331.203857.548691a0.ja.html In this case it is align(8) not align(16), and the thread describes this issue as resolved. T

Re: [C++-sig] Pybindgen/pygccxml integration

2009-06-23 Thread Ben Fitzpatrick
Thanks for the suggestions! I tried the first one, just as a test. I'd like to do the second programatically if I can, but I just wanted to make sure annotations were going to fix this. It still seems to be giving me the same error: (...)/pure_virtual.h:5: WrapperWarning: Parameter 'int * value

Re: [C++-sig] Pybindgen/pygccxml integration

2009-06-23 Thread Gustavo Carneiro
2009/6/23 Ben Fitzpatrick > Hi everyone, > > I'm just starting to check out pybindgen after the messages I've seen > floating around on this mailing list, and I have a question about the > pygccxml integration. I've made a pure-virtual class with a pointer return > type, like so: > > class pure_v

[C++-sig] Pybindgen/pygccxml integration

2009-06-23 Thread Ben Fitzpatrick
Hi everyone, I'm just starting to check out pybindgen after the messages I've seen floating around on this mailing list, and I have a question about the pygccxml integration. I've made a pure-virtual class with a pointer return type, like so: class pure_virtual_class { virtual int get_val

Re: [C++-sig] boost.python: no overflow checking for unsigned int parameters ?

2009-06-23 Thread Ralf W. Grosse-Kunstleve
Thanks for your work! I'm out of town, back in a couple weeks. I'll integrate your changes when I'm back (unless anyone else gets to it before I'm back). Ralf - Original Message From: Anderson Lizardo To: Development of Python/C++ integration Sent: Thursday, June 18, 2009 6:08:20 AM