app.cxx (738B)
1 #include "Python.h" 2 #include <iostream> 3 4 #include "lib.h" 5 // cython function 6 #include "cy_cxxtest_api.h" 7 8 int main(int argc, char** argv) 9 { 10 std::cout << "::: cxx-app\n"; 11 Py_Initialize(); 12 if (!Py_IsInitialized()) { 13 std::cerr << ":: could not initialize python interpreter !\n"; 14 return 1; 15 } else { 16 std::cout << ":: python initialized\n"; 17 } 18 PyEval_InitThreads(); 19 if (!PyEval_ThreadsInitialized()) { 20 std::cerr << ":: could not init GIL !\n"; 21 return 1; 22 } 23 24 if (import_cy_cxxtest()) { 25 std::cerr << "** could not import 'cy_cxxtest' module !\n"; 26 return 1; 27 } else { 28 std::cout << "::: successfully imported 'cy_cxxtest'\n"; 29 } 30 31 cy_hello(); 32 std::cout << "::: cxx-app [done]\n"; 33 return 0; 34 }