Windows dll example?

Jive Dadson dsdfdsadfas at isdfssdfasdf.invalid
Mon Dec 16 17:51:28 EST 2002


One mystery remains.  What's the deal with a .pyd file?  I've found only the sketchiest reference to one in the FAQ.

> 8.12. 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
> foo.pyd, then it must have a function initfoo(). You can then write Python "import foo", 
> and Python will search for foo.pyd (as well as foo.py, foo.pyc) and if it finds it, 
> will attempt to call initfoo() to initialize it. You do not link your .exe with 
> foo.lib, as that would cause Windows to require the DLL to be present. 

I'm not clear on what that means.  Does the phrase "your .exe" refer to python.exe?  You don't have to link python.exe with foo.lib when you use a .dll do you?  Is the .pyd just a renamed .dll that has an initfoo() entry? If so, what is its reason for being?  No foo.def file?  Why would Python look for foo.pyc after it found foo.pyd? -- or did the author mean to say that Python would look for foo.pyc if it didn't find foo.pyd (or presumably foo.dll)?

J.



More information about the Python-list mailing list