We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

Is a PYD file the same as a DLL?

Yes, .pyd files are dll’s, but there are a few differences. If you have a DLL named spam.pyd, then it must have a function initspam(). You can then write Python “import spam”, and Python will search for spam.pyd (as well as spam.py, spam.pyc) and if it finds it, will attempt to call initspam() to initialize it.

Note that the search path for spam.pyd is PYTHONPATH, not the same as the path that Windows uses to search for spam.dll. Also, spam.pyd need not be present to run your program, whereas if you linked your program with a dll, the dll is required. Of course, spam.pyd is required if you want to say “import spam”. In a DLL, linkage is declared in the source code with __declspec(dllexport). In a .pyd, linkage is defined in a list of available functions.

CATEGORY: windows