Re: Extending an embeded Python

2005-04-12 Thread Fredrik Lundh
Mikin von Flap wrote: > PyObject* res0 = Py_InitModule( "stoneage", StoneAgeMethods ); > res1 = PyRun_SimpleString( "stoneage.log( \"test\" )\n" ); // FAIL > res2 = PyRun_SimpleString( "log( \"test\" )\n" ); // FAIL > res3 = PyRun_SimpleString( "print \"test\"\n" ); // OK > Py_Finalize(); > This

Extending an embeded Python

2005-04-12 Thread Mikin von Flap
I'm trying to embed Python in a Windows exe, and extend it with some functions in the same program. So far I only add one function: static PyObject* py_print( PyObject* self, PyObject* args ) { const char* msg; if( !PyArg_ParseTuple( args, "s", &msg ) ) return 0; EventLog::log( msg ); Py_INCREF(