????11.???TestMyPython.py???£???_MyPython.pyd???????????????TestMyPython.py.
import MyPython
import os
o = MyPython.CMyDll()
print(o.SayHello("World"))
class MyPyDll(MyPython.CMyDll):
def __init__(self):
MyPython.CMyDll.__init__(self)
def location(self):
return "Python"
o1 = MyPyDll();
print(o1.SayHello("World"))
os.system("pause")
???????н?????£?
????Hello World. I'm from C++.
????Hello World. I'm from Python.
????Press any key to continue . . .
????12.Run python in MyApp??
???????MyApp?????????????python??????????У???lib?????????С?
???????MyApp.cpp????????£?
#include "stdafx.h"
#include <Python.h>
int _tmain(int argc?? _TCHAR* argv[])
{
Py_Initialize();
PyObject * pModule = PyImport_ImportModule("TestMyPython");
Py_Finalize();
return 0;
}
????????????MyApp.exe????????£?
????Hello World. I'm from C++.
????Hello World. I'm from Python.
????Press any key to continue . . .