Can embedded static-linked python still import dll extensions?

Gordon McMillan gmcm at
Tue Mar 14 18:02:03 CET 2000

Warren Postma wrote:

> I recompiled the Python sources for Windows with config.h and put this line
> in:
> #define MS_NO_COREDLL 1  // build a static library not a DLL!
> Now it statically links fine, but it doesn't allow me to import .pyd files
> (Python extension DLLs). Do you have to use the external Python DLL to allow
> importing modules from DLLs, or can you statically link python but still
> allow external DLL add ons somehow?
> I want my embedded python deeply embedded but I still want to produce .PYD
> style add ons for the system once it's in the field. Am I stuck?

Yes. A .pyd needs addresses of routines in Python. Since 
loading a .dll (which is what a .pyd is) is *not* a full link on 
Windows (unlike loading a .so on *nix), Python needs to be 
built as a .dll (unless you want to go to the work of exposing 
all those routines yourself).

- Gordon

More information about the Python-list mailing list