[C++-sig] Re: please help with simple program crashing
jeff.holle at verizon.net
Thu Jul 1 14:09:52 CEST 2004
Calling Py_Finalize shuts done the python interpreter.
I suspect that is why you were told its not compatiable to boost.python,
since it uses this resource.
Drew Ferraro wrote:
> hi dave,
> thanks for your reply! this might sound stupid, but could you tell me
> what i should do then to have them both use the same standard library?
> im using visual studio .net 2003 if that matters. also, what is the
> alternative to Py_Finalize, and why is it incompatible but the other
> Py_XXX function are not ? thanks for any help! ps, i have boost
> included because i was just using it to do some other stuff (i was
> actually able to call a C++ function through the Py_SimpleString()
> On Thu, 01 Jul 2004 09:52:59 -0400, David Abrahams
> <dave at boost-consulting.com> wrote:
>>Drew Ferraro <gfilla at gmail.com> writes:
>>>ive recently trying to add a scripting system to a game i am making..
>>>anyway, ive started to learn python and am trying to figure out how to
>>>embed it in my game. i have gotten a C++ function to work from inside
>>>C++ but called from python via PyRun_SimpleString(),,, i can send
>>>commands directly to the intepreter with that function, but im having
>>> with PyRun_SimpleFile(). im trying to execute a python script with
>>>this function, but its crashing when it gets to this line:
>>>i cant figure out what im doing wrong. here is the source. any help is
>>One likely possibility is that your Python was built with a different
>>C/C++ standard library than your program, so they have different
>>ideas of what a FILE is supposed to be. Also, Boost.Python is
>>incompatible with Py_Finalize... though it's not clear why you're
>>linking with Boost.Python anyway, since you're not using it.
>>>using namespace std;
>>>using namespace boost::python;
>>> FILE *fp = NULL;
>>> fp = fopen("test.py", "r");
>>> if(fp == NULL)
>>> return 1;
>>> return 0;
>>>thanks for any help! also, i tried not opening the file myself, and
>>>just sending PR_SF() a NULL FILE*... it didnt crash! instead, in the
>>>console it said there was a syntax error and printed out some garbage
>>>characters... i dont think theres a syntax error, "text.py" entire
>>>file just says print "hello world"
>>C++-sig mailing list
>>C++-sig at python.org
More information about the Cplusplus-sig