B
Bakes
Can I use a pyd compiled on linux in a Windows distribution?
Or must I recompile it for windows users?
Or must I recompile it for windows users?
Bakes said:Can I use a pyd compiled on linux in a Windows distribution?
Or must I recompile it for windows users?
Can I use a pyd compiled on linux in a Windows distribution?
No.
Or must I recompile it for windows users?
Christian said:On Linux and several other Unices the suffix is .so and not .pyd.
.so is the common suffix of shared libraries on Linux. IIRC Python
extensions have .pyd on Mac OS X.
Philip said:I've never seen a .pyd under OS X (although that doesn't mean they don't
exist).
The Python extensions I've written in C compile to a .so under OS X.
Christian said:On Windows it used to be .dll, too.
The suffix was changed to avoid issues with other dlls and name clashes.
What clashes? How come other OSes don't seem prone to the same problems?
I don't believe changing the extension modifies the search order forCarl said:Yeah, because who ever heard of one OS having a problem that another
OS didn't?
Windows searches for DLLs on the executable path, which always
includes the current directory. So if you have a module called
system32.dll in your currently directory, you could be in big trouble.
Unix doesn't automatically search the current dir, doesn't use the
executable search path (libraries have their own search path, which is
not used when loading shared libs by hand), and system libraries on
Unix conventionally are prefixed by lib. So name collisions are rare,
but even if if you have a module called libc.so in your current
directory it will not conflict with /lib/libc.so.
Carl Banks
And I'm guessing that CPython searches down sys.path, and when it finds
the module, gives a full path to LoadLibrary(), in which case the DLL
search path is moot.
It's not Python that's the issue. The issue is that if you have a
module with a .dll extension, other programs could accidentally try to
load that module instead of the intended dll, if the module is in the
current directory or system path. Modules will sometimes find
themselves on the path in Windows, so the fact that Windows performs a
library search on the path is quite significant.
Modules will sometimes find
Why is it only Windows is prone to this problem?
On Sat, 2009-10-31 at 21:32 +1300, Lawrence D'Oliveiro wrote:
I think as someone pointed out earlier, in Unix-like operating systems,
a "regular" library's file name starts with "lib", e.g. libcrypt.so. So
this would not conflict with Python's crypt.so.
In message <6e603d9c-2be0-449c-9c3c-
Why is it only Windows is prone to this problem?
In message <6e603d9c-2be0-449c-9c3c-
Why is it only Windows is prone to this problem?
I just checked my Debian installation:
ldo@theon:~> find /lib /usr/lib -name \*.so -a -not -name lib\*
-print | wc -l
2950
ldo@theon:~> find /lib /usr/lib -name \*.so -print | wc -l
4708
So 63% of the shareable libraries on my system have names NOT
beginning with lib.
Any better theories?
OTOH this doesn't happen in Linux because a) programs wanting the
system's crypt library are looking for libcrypt.so and b) Linux doesn't
look in your current directory (by default) for libraries.
I just checked my Debian installation:
ldo@theon:~> find /lib /usr/lib -name \*.so -a -not -name lib\*
-print | wc -l 2950
ldo@theon:~> find /lib /usr/lib -name \*.so -print | wc -l 4708
So 63% of the shareable libraries on my system have names NOT beginning
with lib.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.