the following looks to be correct from all the examples I have found…
if (!FileExists(arg2)) return 0; FILE* fp = fopen(arg2, "rb"); if (fp == NULL) return 0; std::string fname = FileNameFromPath(arg2); return PyRun_SimpleFileExFlags(fp , fname.c_str(), 1, NULL);
I have stepped through the source in the python311 dll and its crashing at
pythonrun.c maybe_pyc_file(FILE *fp, PyObject *filename, int closeit) if (ftell(fp) == 0)
An invalid parameter was passed to a function that considers invalid parameters fatal.
fp is not null and works from within my main body of code…
I have both the python311.dll and my code compiling with /MT and the same platform toolset etc. Something weird is going on.