multiple modules from single c extension

Eric Frederich eric.frederich at gmail.com
Thu Dec 2 11:39:23 EST 2010


Can you explain how to do this with distutils then?
Would I need a separate setup.py for SpamABC and SpamXYZ?
How would I get them included in the parent module Spam?

Could you explain what you mean when you say "The Python import
mechanism will be looking for an appropriately-named .pyd file for
each module"?

Are you saying that in python when I say from "Spam.ABC import *" I
need a file called "Spam.ABC.[so|pyd]"?

On Wed, Dec 1, 2010 at 8:39 PM, Robert Kern <robert.kern at gmail.com> wrote:
> 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
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list