src1.cpp 439 B

123456789101112131415161718192021222324
  1. #include "Python.h"
  2. #include "src1.h"
  3. extern "C"
  4. {
  5. void init_swigdemo(void);
  6. }
  7. TestClass* TestClass::_instance = 0;
  8. int main()
  9. {
  10. Py_Initialize();
  11. init_swigdemo();
  12. /*FILE* file_py;
  13. file_py = fopen(i_oFile.toLocal8Bit(), "r");
  14. PyRun_SimpleFile(file_py, i_oFile.toLocal8Bit());
  15. fclose(file_py);
  16. */
  17. PyRun_SimpleString("import swigdemo, sys\nsys.stderr.write(str(swigdemo.TestClass.instance().test()))");
  18. Py_Finalize();
  19. }