Hi,
Hello,THE PROBLEM:
I am having a problem that I have seen asked quite a bit on the web, with little to no follow up.The problem is essentially this. When embedding (LoadLibraryA()) the python interpreter dllin a non-windows application the developer must first create a console for python to do output/input with.I properly initialize the CRT and AllocConsole() to do this. I then GetSTDHandle() for stdin and stdout accordinglyand open those handles with the requisite flags "read" for STDIN and "write" for stdout. This all works greatand is then verified and tested to work by printf() and fgets(). This issue however happens when attemptingto PyRun_InteractiveLoop() and PyRun_SimpleString(). A PyRun_SimpleString("print 'test'") displays nothing in myfreshly allocated console window. Similarly a PyRun_InteractiveLoop(stdin, NULL); yields nothing either even thoughthe line printf("testing"); directly ahead of it works just fine. Does anyone have insight on how I can make this workwith the freshly allocated console's stdin/stdout/stderr?SPECULATION:That is the question, so now on to the speculation. I suspect that something in the python runtime doesn't "get handles"correctly for STDIN and STDOUT upon initialization. I have perused the source code to find out exactly how this is doneand I suspect that it starts in PyInitializeEx with calls to PySys_GetObject("stdin") and "stdout" accordingly. However Idon't actually see where this translates into the Python runtime checking with the C-runtime for the "real" handles to STDIN and STDOUT. I dont ever see the Python runtime "ask the system" where his handles to STDIN and STDOUT are.