what's the difference between *.dll and *.pyd if both of them are extended python module?

Daniel Dittmar daniel.dittmar at sap.corp
Tue Aug 23 15:33:58 CEST 2005

wen wrote:
> 1. what's the difference between them? i saw the code is same as common c++
> extended python module, can i use microsoft visual C++ to create a dll
> project for compiling it as _cmd.dll?

.pyd is just a naming convention. It was probably introduced to prevent 
name clashes with unrelated DLLs.

> 2. i have never written a module with extension *.pyd, how to make a *.pyd?
> and, i doubt, how the author debug the _cmd.pyd, only by Makefile?

I think you can configure the output file name in the project properties.

> 3. i have a common problem about writting a extend module by c/c++, i often
> use msvc to write it, but i only can invoke release dll, not debug dll, even
> i use command like this: python_d test.py, in which case, test.py import
> test.dll, and invoke test.hello() api. why? anybody has nice way to debug
> it? thank you.

Assuming your module is called _cmd:
- add a function init_cmd_d to the extension module (init_cmd_d simply 
calls init_cmd)
- import cmd_d in your Python script

I must admit I haven't tried this, it is based on my understanding of 
how Python loads extension modules.


More information about the Python-list mailing list