• Main Page
  • Classes
  • Files
  • File List
  • File Members

Beesnest/Engines/BnPython/Main.cpp

Go to the documentation of this file.
00001 #include "Main.h"
00002 
00003 PyThreadState* mainThreadState = NULL;
00004 
00005 extern "C"
00006 bool __declspec(dllexport)
00007 __stdcall GetEngine (IdcEngine** pp_engine,
00008                      const char* name, bool (*pGetParam)(const char*, char*, int))
00009 {
00010     *pp_engine = new BnPython (name, pGetParam);
00011     if (pp_engine == NULL)
00012         return false;
00013     return true;
00014 }
00015 
00016 extern "C"
00017 void __declspec(dllexport) __stdcall Init ()
00018 {
00019     /* initialize Python */
00020     Py_InitializeEx(0);
00021     PyEval_InitThreads();
00022     mainThreadState = PyThreadState_Get();
00023     PyEval_ReleaseLock();
00024 }
00025 
00026 extern "C"
00027 void __declspec(dllexport) __stdcall Term ()
00028 {
00029     /* shut down the interpreter */
00030     PyEval_AcquireLock();
00031     PyThreadState_Swap(mainThreadState);
00032     Py_Finalize();
00033 }
00034 

Generated on Mon Oct 11 2010 16:23:23 for Beesnest by  doxygen 1.7.2