When does a binary extension gets the file extension '.pyd' and when is it '.so'

Steve Holden steve at holdenweb.com
Sat Apr 5 08:40:40 EDT 2008


llothar wrote:
> On 5 Apr., 15:48, Fredrik Lundh <fred... at pythonware.com> wrote:
>> llothar wrote:
>>> My question was: Why does setup.py generated sometimes a pyd and
>>> sometimes a so file?
>> setup.py picks an extension that happens to work on the platform you're
>> running setup.py on.  doing otherwise would be pretty pointless.
>>
>> </F>
> 
> Unfortunately as pointless as the answers i got so far.
> 
Right, so you think people aren't trying to help you?

Put your paranoia back in your pocket :-)
> 
> Okay i try it one more time:
> 
> I ship an application that compiles an python interpreter and
> extension on a remote system.
> It also needs to copy this created items around. So if i use setup.py
> to create an
> extension i need  to know the file name of the generated file.
> 
> Damned this is trivial and a fundamental question and it is not
> documented anywhere.
> 
> I have a clue at the moment that it might be ".so" when python is
> compiled without shared library
> and ".pyd" otherwise (configure option --enable-shared) . But this is
> just a guess. Does anybody know?
> 
> And by the way: I think this is a bug and should be fixed. If the
> platform does allow renaming the
> extension of a DLL (does HP/UX allow this?) it should always be
> ".pyd"

You display your ignorance here. The ".pyd" extension is used on Windows 
as an alternative to ".dll", but both are recognized as shared 
libraries. Personally I'm not really sure why they even chose to use 
".pyd", which is confusing to most Windows users. In UNIX/Linux 
environments ".so" is the standard extension for a shared library.

To depart from the platform standard would be unhelpful and confusing to 
the majority of users. It's know use telling us what you think: tell us 
instead the compelling reasons why your opinion is correct. Opinions, 
after all, are so cheap that everyone can have one.

There are ways to build distributions of Python extensions (modules or 
packages involving binary code from languages like C or C++), but you 
will want to understand a bit more about computing in general (and work 
on your social skills ;-) before you start to approach them.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list