[C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Olivier Voyer
Hi everyone, Is it possible to have multiple modules linking to one single pyd file? I'm using SWIG with VS2010 and I can't find a way of doing that. Thank you, Olivier ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mail

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Jim Bosch
On Nov 15, 2011 8:53 AM, "Olivier Voyer" wrote: > > Hi everyone, > > Is it possible to have multiple modules linking to one single pyd file? I'm using SWIG with VS2010 and I can't find a way of doing that. > I believe this is not supported by the Python C-API itself, regardless of what wrapper ge

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Olivier Voyer
Jim, thank you for your answer. What if I have this big C++ project that I cannot split in multiple smaller projects? I have no choice but to create a big Python module exposing all the functions/classes? What is the common practice? Regards, Olivier On Tue, Nov 15, 2011 at 9:24 AM, Jim Bosch

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Jérôme Laheurte
Le 15 nov. 2011 à 15:24, Jim Bosch a écrit : > On Nov 15, 2011 8:53 AM, "Olivier Voyer" wrote: > > > > Hi everyone, > > > > Is it possible to have multiple modules linking to one single pyd file? I'm > > using SWIG with VS2010 and I can't find a way of doing that. > > > > I believe this is not

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Jim Bosch
On 11/15/2011 10:00 AM, Olivier Voyer wrote: Jim, thank you for your answer. What if I have this big C++ project that I cannot split in multiple smaller projects? I have no choice but to create a big Python module exposing all the functions/classes? What is the common practice? It sounds like

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Jim Bosch
On 11/15/2011 09:51 AM, Jérôme Laheurte wrote: But you can put several submodules in an extension module, as a workaround (see code below). I always wondered if that was possible with boost::python or SWIG ? Interesting, I hadn't thought of that. Anyhow, I believe it should be possible (but n

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Olivier Voyer
Yes, that's exactly what I want to do. But, from what I understand, each module or submodule (.py file) must link to its own .pyd file, ie module1.py -> _module1.pyd, module2.py -> _module2.pyd. What I would really love to have is: myPackage/ myPackage/__init__.py myPackage/module1.py -> linked t

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Wichert Akkerman
On 11/15/2011 03:51 PM, Jérôme Laheurte wrote: Le 15 nov. 2011 à 15:24, Jim Bosch a écrit : On Nov 15, 2011 8:53 AM, "Olivier Voyer" wrote: Hi everyone, Is it possible to have multiple modules linking to one single pyd file? I'm using SWIG with VS2010 and I can't find a way of doing that.

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Wichert Akkerman
On 11/15/2011 04:42 PM, Olivier Voyer wrote: Yes, that's exactly what I want to do. But, from what I understand, each module or submodule (.py file) must link to its own .pyd file, ie module1.py -> _module1.pyd, module2.py -> _module2.pyd. What I would really love to have is: myPackage/ myPac

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Olivier Voyer
Bingo! But I'm not sure how to do that... at this moment I'm using SWIG as a C++ wrapper. Do I only need to modify the __init__py file at the root of my package? On Tue, Nov 15, 2011 at 10:47 AM, Wichert Akkerman wrote: > On 11/15/2011 04:42 PM, Olivier Voyer wrote: > >> Yes, that's exactly what

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Wichert Akkerman
On 11/15/2011 04:52 PM, Olivier Voyer wrote: Bingo! But I'm not sure how to do that... at this moment I'm using SWIG as a C++ wrapper. Do I only need to modify the __init__py file at the root of my package? Personally I don't have a single .py file for my extensions, I just drop in a single m

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Jérôme Laheurte
Le 15 nov. 2011 à 16:20, Jim Bosch a écrit : > On 11/15/2011 10:00 AM, Olivier Voyer wrote: >> Jim, thank you for your answer. >> >> What if I have this big C++ project that I cannot split in multiple >> smaller projects? I have no choice but to create a big Python module >> exposing all the fun

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Jérôme Laheurte
Le 15 nov. 2011 à 16:08, Wichert Akkerman a écrit : > On 11/15/2011 03:51 PM, Jérôme Laheurte wrote: >> Le 15 nov. 2011 à 15:24, Jim Bosch a écrit : >> >>> On Nov 15, 2011 8:53 AM, "Olivier Voyer" wrote: Hi everyone, Is it possible to have multiple modules linking to one single

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Jérôme Laheurte
Le 15 nov. 2011 à 17:15, Jérôme Laheurte a écrit : > > Le 15 nov. 2011 à 16:20, Jim Bosch a écrit : > >> On 11/15/2011 10:00 AM, Olivier Voyer wrote: >>> Jim, thank you for your answer. >>> >>> What if I have this big C++ project that I cannot split in multiple >>> smaller projects? I have no

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Niall Douglas
On 15 Nov 2011 at 10:00, Olivier Voyer wrote: > What if I have this big C++ project that I cannot split in multiple smaller > projects? I have no choice but to create a big Python module exposing all > the functions/classes? What is the common practice? You are aware, I assume, that the python wr

Re: [C++-sig] [Boost.Python] How to adjust Python reference counts for hybrid objects?

2011-11-15 Thread Jim Bosch
On 11/14/2011 09:54 PM, Per Knudsgaard wrote: I have gotten (3) to work, but I am wondering about two things. Since I couldn't get the constructor to work, I went for a modifier that returns the object. Sorry no one responded to your questions earlier. I havne't looked too closely yet, but I th

Re: [C++-sig] [Boost.Python] How to adjust Python reference counts for hybrid objects?

2011-11-15 Thread Per Knudsgaard
Thanks for your answer. I generally prefer intrusive pointers for a number of reasons: They are safer (no problems converting between raw and managed). They are generally faster (no cache misses because the reference count is embedded in your object). They don't require extra allocatio