multiple modules from single c extension

Robert Kern robert.kern at gmail.com
Wed Dec 1 20:39:14 EST 2010


On 12/1/10 4:12 PM, Eric Frederich wrote:
> I have an extension to some C library that I created using the guide
> found here...
>
>      http://docs.python.org/extending/extending.html
>
> I am starting to have A LOT of functions being wrapped.
>
> The library that I'm creating bindings for is organized into modules.
> In fact, all of their function calls start with a prefix like
> ABC_do_something, XYZ_something_else.
>
> I'd like to start putting the bindings for each module into a separate
> C file and have each set of bindings end up in its own Python module
> as well.
>
> Is this possible to do using a single .dll / .pyd file so that I can
> use a single Visual Studio project for these bindings?

No, I don't think so. The Python import mechanism will be looking for an 
appropriately-named .pyd file for each module. In any case, you shouldn't be 
using Visual Studio directly to build the .pyd. Instead, use distutils.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list