Re: [C++-sig] [pybindgen] custom selections with pybindgen and pygccxml

2008-10-17 Thread Gustavo Carneiro
2008/10/17 Adrien Saladin <[EMAIL PROTECTED]> > Hi, > > I would like to give pybindgen a try on a C++ library. I'm currently > using Py++ (which is great) to automatically generate the correct > interface. > Before seriously playing with pybindgen, I need to know if it is > possible to do a fine s

Re: [C++-sig] new to python; old to C++

2008-10-31 Thread Gustavo Carneiro
2008/10/31 Stefan Seefeld <[EMAIL PROTECTED]> > Alan Baljeu wrote: > > Question: which python-calling-C++ tool should I try? >> >> > > Wow, quiet group. I guess I'll try pybindgen first. >> >> > > That may be because the question is not quite clear. > First of all, you should realize that, desp

Re: [C++-sig] new to python; old to C++

2008-11-01 Thread Gustavo Carneiro
2008/11/1 Greg Landrum <[EMAIL PROTECTED]> > On Sat, Nov 1, 2008 at 4:48 AM, Alan Baljeu <[EMAIL PROTECTED]> wrote: > > > > It was a personal question. Do you specifically do much wrapping stuff > or not? I'm > > trying to gauge your approach compared to how much you do it. I mean, if > I had >

Re: [C++-sig] new to python; old to C++

2008-11-01 Thread Gustavo Carneiro
2008/11/1 Paul Melis <[EMAIL PROTECTED]> > Gustavo Carneiro wrote: > > > > There's an interesting question about whether it's better to use > > boost.python or SWIG. I've been using boost.python for years, so I > > have a lot invest

Re: [C++-sig] new to python; old to C++

2008-11-01 Thread Gustavo Carneiro
2008/11/1 Alan Baljeu <[EMAIL PROTECTED]> > 2008/11/1 Greg Landrum <[EMAIL PROTECTED]> > <<< > My opinion is biased, of course, but I use PyBindGen, usually with the help > of pygccxml for automatic scanning. I recommend PyBindGen for people that > dislike the kind of C++ template abuse that boos

Re: [C++-sig] [pybindgen] references?

2008-11-03 Thread Gustavo Carneiro
2008/11/3 Alan Baljeu <[EMAIL PROTECTED]> > I just read the tutorial page on pybindgen, but it doesn't talk about > reference types. 99% of my C++ code involves passing around things like > foo&, so this is significant to me. How is it done? e.g.: MyClass.add_method("foobar", retval('void'),

Re: [C++-sig] [pybindgen] references?

2008-11-04 Thread Gustavo Carneiro
2008/11/4 Alan Baljeu <[EMAIL PROTECTED]> > Glad to read this here. I agree with you about the dislike thing. I can't > stand auto_ptr, and if I had to give an object control over the life of > another object I would generally choose a shared_ptr protocol. I mean, the > object existed fine befo

Re: [C++-sig] [pybindgen] references?

2008-11-04 Thread Gustavo Carneiro
2008/11/3 Stefan Seefeld <[EMAIL PROTECTED]> > Alan Baljeu wrote: > >> I just read the tutorial page on pybindgen, but it doesn't talk about >> reference types. 99% of my C++ code involves passing around things like >> foo&, so this is significant to me. How is it done? >> >> > > If you need fin

Re: [C++-sig] looking up functions

2008-11-13 Thread Gustavo Carneiro
2008/11/13 Alan Baljeu <[EMAIL PROTECTED]> > I'm reading the Python extension tutorial, and I cannot believe the > embedding section. It tells me the only way to call a python function is to > callout to python to pass back a function object which I then save so I can > call it when I need to. T

Re: [C++-sig] gccxml

2008-12-02 Thread Gustavo Carneiro
2008/12/2 Alan Baljeu <[EMAIL PROTECTED]> > I would make a contribution to some projects. GCC-XML is not one of them, > seeing how it's not even worth my effort to try to install and configure > this stuff. If I were involved with these packages, I would make it easy > for others to get involved

Re: [C++-sig] gccxml

2008-12-02 Thread Gustavo Carneiro
2008/12/2 Mathieu Malaterre <[EMAIL PROTECTED]> > 2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: > > 2008/12/2 Alan Baljeu <[EMAIL PROTECTED]> > >> > >> I would make a contribution to some projects. GCC-XML is not one of > them, > >> s

Re: [C++-sig] gccxml

2008-12-02 Thread Gustavo Carneiro
2008/12/2 Mathieu Malaterre <[EMAIL PROTECTED]> > 2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: > > > > > > 2008/12/2 Mathieu Malaterre <[EMAIL PROTECTED]> > >> > >> 2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: > >> &g

[C++-sig] ANN: PyBindGen 0.10 released

2008-12-08 Thread Gustavo Carneiro
PyBindGen is a Python module that is geared to generating C/C++ code that binds a C/C++ library for Python. It does so without extensive use of either C++ templates or C pre-processor macros. It has modular handling of C/C++ types, and can be easily extended with Python plugins. The generated code

Re: [C++-sig] pybindgen add_function_as_constructor

2009-04-27 Thread Gustavo Carneiro
2009/4/27 Robin Gilks > Robin Gilks wrote: > >> I've found the pybindgen commit for revision 628 and that fixes the >> PyObject problem - got a new one now!! I can't work out the syntax to return >> any sort of pointer for example >> mod.add_method('methodA', ReturnValue.new('uint8_t *'), []) >

Re: [C++-sig] pybindgen add_function_as_constructor

2009-04-28 Thread Gustavo Carneiro
2009/4/27 Robin Gilks > Gustavo Carneiro wrote: > >> >> Sounds good. >> >> Sorry I wasn't online to help with the other questions. I assume those >> problems are solved, if not please ask again the questions. >> >> >>Where I've

Re: [C++-sig] pybindgen: Why do wrapped C++ containers not look more like python containers?

2009-06-04 Thread Gustavo Carneiro
2009/6/4 J. Michael Owen > I've been looking at pybindgen and have a simple question -- why do the > container wrappers not implement more of the python container interface? > For instance, you can expose the std::vector like so: > > vecint = mod.add_container("std::vector", "int","v

Re: [C++-sig] pybindgen: Why do wrapped C++ containers not look more like python containers?

2009-06-05 Thread Gustavo Carneiro
2009/6/5 Taner Yildirim > Dear Mike, > > > > Concerning your question about add_method for stl_vector, I was able to add > > > almost all standard methods of std_vector by simply wrapping the > std::vector without > > even using the mod.add_container!! Since I am very new to pybindgen, > > I am

Re: [C++-sig] pybindgen: Why do wrapped C++ containers not look more like python containers?

2009-06-05 Thread Gustavo Carneiro
2009/6/5 J. Michael Owen > Hi Taner, > Thanks for the suggestion! I actually was trying the same solution, except > I wasn't sure how to handle the iterators. I'll try it out as you do in > your example -- are you able to iterate over the vector in python the usual > way? As in "for x in vec:"

Re: [C++-sig] pybindgen: Why do wrapped C++ containers not look more like python containers?

2009-06-07 Thread Gustavo Carneiro
2009/6/7 Taner Yildirim > Dear Mike, > > > > I noticed that the special function __call__ works in pybindgen. When I use > the custom_name as __call__, then I can get the vector as (i)! > > In cppclass.py, the program checks if the name== __call__ to treat this > case specially and then converts

Re: [C++-sig] pybindgen: Why do wrapped C++ containers not look more like python containers?

2009-06-07 Thread Gustavo Carneiro
2009/6/7 Taner Yildirim > Dear Gustavo, > > > > Thanks for your detailed response. I hope pybindgen soon will have the full > support for the stl-containers! > > I am looking forward to that particular version! Hopefully in the near > future, I will learn more about pybindgen and maybe contribut

Re: [C++-sig] pybindgen: Why do wrapped C++ containers not look more like python containers?

2009-06-07 Thread Gustavo Carneiro
2009/6/7 Taner Yildirim > Dear Gustavo, > > > > Thanks for the detailed explanation, which fixed the problem!. As I > indicated in my previous email, I am mainly a Fortran programmer and do not > have much experience with c++. I used to wrap my programs with F2Py but then > decided to do right

Re: [C++-sig] pybindgen: Why does pybindgen want to call constructors for a singleton class?

2009-06-22 Thread Gustavo Carneiro
2009/6/22 J. Michael Owen > I'm looking at wrapping a C++ singleton with pybindgen, and it seems that > if I expose the method for getting the instance to python the generated code > wants to call a copy constructor, which seems wrong to me. If for instance > I define a class "A" as a singleton:

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

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

2009-06-23 Thread Gustavo Carneiro
r (Zbr *zbr); > > Also tried renaming it to 'foobaz' in case 'value' was a keyword. Is there > something I'm missing? > > Thanks, > Ben Fitzpatrick > > > Gustavo Carneiro wrote: > >> >> >> 2009/6/23 Ben Fitzpatrick > bfit

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 se

Re: [C++-sig] pybindgen: allow_subclassing option causing reference parameters to be copied?

2009-06-24 Thread Gustavo Carneiro
2009/6/24 J. Michael Owen > Hi again, > > I've run across another issue confusing me as I try to use pybindgen, in > this case it's the treatment of reference parameters in virtual methods > where you're allowing the class to be subclassed from python. It looks like > the helper class that is ge

Re: [C++-sig] pybindgen: allow_subclassing option causing reference parameters to be copied?

2009-06-24 Thread Gustavo Carneiro
on it will crash. And this would not need any options. It's always best to do the smart thing when possible without asking too many questions ;-) > > On Jun 24, 2009, at 3:31 PM, Gustavo Carneiro wrote: > > Sorry, but in this case the answer is no. The virtual method wrapper here &g

Re: [C++-sig] pybindgen: allow_subclassing option causing reference parameters to be copied?

2009-06-28 Thread Gustavo Carneiro
2009/6/25 Gustavo Carneiro > > > 2009/6/25 J. Michael Owen > >> I can see what you're worried about here, but as a practical matter it is >> very useful to be able to pass stuff by reference, and copying it under the >> hood will break code. For instance,

Re: [C++-sig] pybindgen: Why do wrapped C++ containers not look more like python containers?

2009-06-28 Thread Gustavo Carneiro
so added inplace_numeric_operators as an option for CppClass, > which fills in the appropriate slots in the number methods struct. > > 3. I added name mangling for template arguments, since some of my template > arguments for methods are themselves templates (such as in the exampl

Re: [C++-sig] pybindgen: allow_subclassing option causing reference parameters to be copied?

2009-06-30 Thread Gustavo Carneiro
we want. Why is > it trying to do that anyway? This was all generated with pybindgen 0.10.0 > by the way -- is there a more recent version that will avoid this problem? > Ah, right. The thing is, the code tries to make a copy of the object to give to the python

Re: [C++-sig] pybindgen: allow_subclassing option causing reference parameters to be copied?

2009-07-07 Thread Gustavo Carneiro
): > return Parameter.new(ref("const %s&" % cppobj), argname, > direction=Parameter.DIRECTION_INOUT) > > So on those changes I have for the pybindgen code (allowing the stuff I > mention above), I'd be happy to modify them to fit in better with how you > want pyb

Re: [C++-sig] pybindgen: allow_subclassing option causing reference parameters to be copied?

2009-07-08 Thread Gustavo Carneiro
are passing. There are three altered files I'm including > here: cppclass.py, pytypeobject.py, and utils.py. > Pushed these changes, with memory leaks fixed. Thanks. > > Mike. > > > > > > > > On Jul 7, 2009, at 8:27 AM, Gustavo Carneiro wrote: > >> >

[C++-sig] Announce: PyBindGen 0.11 released

2009-07-12 Thread Gustavo Carneiro
To integrate some recent contributions, here's a new PyBindGen 0.11 release. About: PyBindGen is a Python bindings generator written in Python. Download: http://code.google.com/p/pybindgen/ Summary of changes: - Generate code that supports GCC's -fvisibility=hidden - Add rudimentary s

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

2009-08-20 Thread Gustavo Carneiro
ate function even works… but the get_value > function doesn’t appear when I dir the class. Set_value appears and seems to > work, so why not get? Any ideas? > > > > I’m on a clean Debian Etch install (virtual machine), using GCC 4.3.2, > Python 2.5.2, gccxml 0.9. > &g

[C++-sig] ANN: PyBindGen 0.12 released

2009-09-01 Thread Gustavo Carneiro
PyBindGen is a Python module that is geared to generating C/C++ code that binds a C/C++ library for Python. It does so without extensive use of either C++ templates or C pre-processor macros. It has modular handling of C/C++ types, and can be easily extended with Python plugins. The generated code

Re: [C++-sig] Trouble optimizing Boost.python integration

2009-09-08 Thread Gustavo Carneiro
2009/8/25 Dan Sanduleac > Hi, > > I'm trying to compare different python-C wrapping techniques to see which > would be faster and also more suited to game development. > If your project does not use multiple inheritance, I may suggest you also try with PyBindGen: http://code.google.com/p/pybindg

Re: [C++-sig] Trouble optimizing Boost.python integration

2009-09-08 Thread Gustavo Carneiro
2009/9/8 Stefan Seefeld > On 09/08/2009 10:51 AM, Gustavo Carneiro wrote: > >> 2009/8/25 Dan Sanduleac > sanduleac@gmail.com>> >> >>Hi, >> >>I'm trying to compare different python-C wrapping techniques to >>see which

Re: [C++-sig] Python C++ extension (multi threaded) raises access violation exception

2009-12-07 Thread Gustavo Carneiro
2009/12/8 Jadhav, Alok > I am using SWIG to extend Python to C++. But the questions I have > consists of basic Python C API related. I hope this list will be able to > help me. > > I am trying to solve a simple problem which many of you must have > encountered. I wonder what I am doing differe

Re: [C++-sig] Implementation of proper overload resolution

2009-12-18 Thread Gustavo Carneiro
Don't you think that when these overloading problems become an issue it is a sign of a poorly designed API? I mean, if overloaded functions parameters are not completely different in type or number, then maybe they are already too confusing to use and should not be overloaded in the first place?..

[C++-sig] ANN: PyBindGen 0.13 released

2009-12-21 Thread Gustavo Carneiro
PyBindGen is a Python module that is geared to generating C/C++ code that binds a C/C++ library for Python. It does so without extensive use of either C++ templates or C pre-processor macros. It has modular handling of C/C++ types, and can be easily extended with Python plugins. The generated code

Re: [C++-sig] Trying to implement subscriptable type in c++.

2009-12-23 Thread Gustavo Carneiro
In Python C API you cannot define a __getitem__ method; instead define a tp_as_mapping slot. See: http://docs.python.org/c-api/typeobj.html#tp_as_mapping 2009/12/23 Anita A > Hi all, > > I am trying to implement a subscriptable type in c++ (equivalent to python > dict), but I get a 'type is u

Re: [C++-sig] Pybindgen and enum types

2010-01-19 Thread Gustavo Carneiro
On Mon, Jan 18, 2010 at 9:48 PM, Ben Fitzpatrick < bfitzpatr...@vtiinstruments.com> wrote: > Hi everyone, > > > > I am trying to wrap a section of C++ code with many enum types in it, of > the form: > > > > enum Blah > > { > > BlahSomething1 = 1000; > > BlahSomething2 = 1001; > > } > > > > Th

Re: [C++-sig] Boost-python/pybindgen and wrapping member variables

2010-01-20 Thread Gustavo Carneiro
On Wed, Jan 20, 2010 at 5:43 PM, Ben Fitzpatrick < bfitzpatr...@vtiinstruments.com> wrote: > Hi everyone, > > > > I think I’m finally getting the hang of this, I seem to have gotten almost > everything in my project working thanks to Gustavo’s latest pybindgen patch. > One of the remaining things

Re: [C++-sig] Boost-python/pybindgen and wrapping member variables

2010-01-20 Thread Gustavo Carneiro
abbed a new checkout of pybindgen and > re-installed it. > > > > *From:* > cplusplus-sig-bounces+bfitzpatrick=vtiinstruments@python.org[mailto: > cplusplus-sig-bounces+bfitzpatrick = > vtiinstruments@python.org] *On Behalf Of *Gustavo Carneiro > *Sent:* Wednesday, Janu

Re: [C++-sig] how do i interrupt a C++ extension?

2010-02-03 Thread Gustavo Carneiro
On Wed, Feb 3, 2010 at 9:42 PM, Ralf W. Grosse-Kunstleve wrote: > It would be a nice feature to have, but in 8+ years working with > Boost.Python I never truly needed it. > > I figure if your extension runs a long time it must have some layers of > loops. If you can modify the > extension code, I'

[C++-sig] ANN: PyBindGen 0.14

2010-02-07 Thread Gustavo Carneiro
PyBindGen is a Python module that is geared to generating C/C++ code that binds a C/C++ library for Python. It does so without extensive use of either C++ templates or C pre-processor macros. It has modular handling of C/C++ types, and can be easily extended with Python plugins. The generated code

Re: [C++-sig] ANN: PyBindGen 0.14

2010-02-07 Thread Gustavo Carneiro
On Sun, Feb 7, 2010 at 8:57 PM, Neal Becker wrote: > PyBindGen shows an example wrapping STL containers. What if I need to wrap > my own containers? Is there some generic container machinery? > Yes, there is some generic container machinery, although it currently is duplicating the STL contain

Re: [C++-sig] Exceptions with pybindgen and gccxmlparser

2010-02-12 Thread Gustavo Carneiro
On Thu, Feb 11, 2010 at 6:16 PM, James Vogel wrote: > Hello -- > > Trying to use pybindgen.gccxmlparser, and running into an issue with > exception handling. > > I have a virtual class that declares > virtual int throw_error() throw (std::exception); > and a non-virtual class that extends the virt

Re: [C++-sig] Callbacks in PyBindGen

2010-05-19 Thread Gustavo Carneiro
On Tue, May 18, 2010 at 14:23, cammm wrote: > > So I've just started playing with pybindgen and having used pyobject plus > and > boost::python before I have to say, it is a breathe of fresh air. > > Simple, explicit, fast and written in python. I'm not a fan of automatic > coverage / source code

Re: [C++-sig] Callbacks in PyBindGen

2010-05-19 Thread Gustavo Carneiro
Example: http://bazaar.launchpad.net/~gjc/pybindgen/trunk/revision/766 <http://bazaar.launchpad.net/~gjc/pybindgen/trunk/revision/766>(don't forget the previous revision 765 for a bug fix) On Wed, May 19, 2010 at 10:36, Gustavo Carneiro wrote: > > > On Tue, May 18, 2010 at

Re: [C++-sig] Linking issues with Boost.Python

2010-08-19 Thread Gustavo Carneiro
On Wed, Aug 18, 2010 at 18:02, Niall Douglas wrote: [...] > > As Nat said, bjam is the core of Boost Build but Boost adds a lot to > it. I've always found it lacking in configurability personally, and > like Nat I'm also not fond of its syntax either - much like CMake > too. I will say though that