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

W

wen

i have written python extend module by c/c++, but i saw a module of a
software(pyMOL, you can get it from http://pymol.sourceforge.net/) called
_cmd.pyd instead of _cmd.dll. and it is written by c/c++ also, the author
use makefile to compile it into _cmd.pyd. i have some question about it:
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?
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?
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.


any help would be appreciated.


with my best regards,
Wen
 
D

Daniel Dittmar

wen said:
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.

Daniel
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top