[EMAIL PROTECTED] wrote: > it works! > could i cache maindict pointer in a global var or am i condemned to > call > PyObject* mainmod = PyImport_AddModule("__main__"); > assert(mainmod); > PyObject* maindict = PyModule_GetDict(mainmod); > assert(maindict); > every time i want to PyRun_String? > i call Py_Finalize only atexit. > > i also found boost library docs of some help: > http://service-spi.web.cern.ch/service-spi/external/Boost/1.30.0/rh73_gcc32/libs/python/doc/tutorial/doc/using_the_interpreter.html > > btw what kind of object is returned in case i use Py_file_input > in PyRun_String? >
Yes, you can keep a reference to maindict if you wish, but make sure you increment the reference count since PyModule_GetDict() returns a borrowed reference. -Farshid -- http://mail.python.org/mailman/listinfo/python-list