win32 python as a dll?

Gordon McMillan gmcm at hypernet.com
Thu Jul 8 14:57:13 EDT 1999


Scott Wolford writes:

> I'm beginning to question my sanity. Try this:
> 
> #include "Python.h"
> #include <stdio.h>
> int main(int argc, char **argv)
> {
> //  return Py_Main(argc, argv);
>   FILE *file = fopen(argv[1], "rt");
>    Py_Initialize();
>   PyRun_AnyFile(file, argv[1]);
> }
> 

Getting rid of the 't' in "rt", adding a "return 0;" to get rid of 
the warning and (in the absence of error checking) making sure 
argv[1] is a valid file, it works.

- Gordon




More information about the Python-list mailing list