Using Python to Execute a C or FORTRAN Program (Windows)

W. eWatson wolftracks at invalid.com
Wed Dec 16 21:41:37 EST 2009


Mensanator wrote:
> On Dec 14, 8:14�pm, "W. eWatson" <wolftra... at invalid.com> wrote:
>> I think Python is capable of executing a compiled C or FORTRAN program,
> 
> Sure, if it was compiled to an .exe file.
> 
>> and maybe even getting some parameters passed back.
> 
> Sure, if the program prints to stdout.
> 
>> Does anyone have a
>> example of how this might be done? I'm running under Win XP Pro.
> 
> Here's one. The test program is factor.exe (included in
> the MIRACL library). I recompiled it (factor!.exe) to
> produce consitent output.
...
Thanks. OK, I think I can follow that. I want to pass it along to 
someone who either missed this possibility in some coding, ignored it, 
or felt more comfortable about just writing the whole program from 
scratch in c++. His program was originally written in Python, but a new 
hardware device (capture card) had no good interface with Python, so he 
wrote it in C++, which does. From my knowledge of the Python program 
before the entry of c++, it seems he could have farmed out the hardware 
interface in much the same way he had done it before with a capture card 
well know to him.

Would the same Python interface work for a compiled C++ program?



More information about the Python-list mailing list