2

Suppose I have a python module compiled from C++ called Foo (Foo.pyd). Can I call python from the .pyd module? Is it going to use the same interpreter that is running Foo.pyd, or it runs another interpreter?

Assuming I do not use boost python or swig, i.e., only native Python-C API is available.

JBL
  • 12,588
  • 4
  • 53
  • 84
szli
  • 36,893
  • 11
  • 32
  • 40
  • Can you be more specific by what you mean by "call python"? Normally the Python interpreter is initialized by Py_Initialize(). Since you're talking about an extension, you won't be doing that, you will only need to use the Python C-API to do calls. – Nick Jun 21 '13 at 23:42
  • @Nick "Call Python " I mean call python code, import some module and execute some function in Python. If I do not do Py_Initialize(), the environment seen by C++ code in Foo (e.g., PYTHONPATH, global dictionary) is the same as the outer level python interpreter (which imported Foo), right? – szli Jun 22 '13 at 16:31

0 Answers0