How do I embed Python on Windows NT? Docs don't help!

Ed_Stauff at Ed_Stauff at
Sun May 7 05:48:32 CEST 2000

I'm trying to learn how to embed Python in an application using
MSVC++ 6.0 on Windows NT.  I'm not getting very far, and the
documentation leaves much to be desired.  I'm an experienced C++
developer, but am new to both Python and DLL's.

I successfully built "pythonw_d.exe" in the PCbuild directory, but it
doesn't do anything!  No console, no output, no error messages,
nothing.  When I took away "python15_d.dll", then "pythonw_d.exe"
rewarded me with an error dialog that it couldn't find the DLL, so I
know it's trying to do *something*, but I can't get it to give me any
kind of input window.

I tried to write a super-simple console app that includes the Python
interpreter, using the program in the PCbuild directory as a guide,
but I can't even get it to link.  "WinMain" calls "Py_Main", but
neither links it not explicitly loads a DLL, and it comes up
undefined at link time (no surprise).  How is this symbol resolved?!?

There's a mysterious file in the "pythonw" project called
"python15" that I assume has something to do with the DLL, but MSVC
refuses to tell me anything about it, and I find no mention of it in
"pythonw.dsp", so I haven't the faintest idea of how to include it in
my own program.  I tried to add "python15_d.dll" to my project, but
it didn't show up like the mystery file in the demo project, so I
removed it.

And yes, I've read all the docs and ReadMe files that I could find,
as well as cruised the net for an hour or two trying to find more

*** HELP!!! ***

How do I embed the Python interpreter using a DLL?  Should I even
bother with this DLL stuff, or should I just try to embed it directly
(compile & link all the Python files into my app)?  My eventual goal
is to add to an existing application a new console-type window that
will serve as the I/O for an embedded Python interpreter, and then
extend the embedded Python engine so that it can access various C++
objects in my existing application.  For now, I'll settle for solving
the how-do-I-embed-it question; one thing at a time.

Any help that anyone can give me would be GREATLY appreciated.  If
someone who's done this before would be willing to act as an
electronic mentor for a few weeks while I learn how to do this, that
would be ideal.  I'm sure I can come up with some suitable reward.


-- Ed

| Ed Stauff, principal software eng.  | I don't speak | "Specialization  |
| Avid Technology, Tewksbury MA, USA  | for Avid, nor | is for insects." |
| "" (remove #'s) | vice versa.   | -- Lazarus Long  |

More information about the Python-list mailing list