Hallöchen!

I'd like to script C++ funtions by an embedded Python interpreter.
So far, my C++ main() function contains:

  Py_Initialize();
  Py_InitModule("pp3", PythonMethods);
  PyRun_SimpleString("from pp3 import *");
  PyRun_AnyFile(stdin, NULL);
  Py_Finalize();

"PythonMethods" is the vector of type PyMethodDef that contains the
function descriptors:

static PyMethodDef PythonMethods[] = {
  {"toll", py_toll, METH_VARARGS, ""},
  {NULL, NULL, 0, NULL}
};

Then I say "toll()" in the input script which calls py_toll() in the
C++ source.


It works.  However, is there a way to avoid this dummy "pp3" module
and add the C++ functions directy to the main namespace in the
Python script?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus            ICQ 264-296-646
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to