//  // // # # ### # # -= Nuclex Project =-  // // ## # # # ## ## NuclexPython.cpp - Rar plugin implementation  // // ### # # ###  // // # ### # ### The plugin implementation for nuclex  // // # ## # # ## ##  // // # # ### # # R1 (C)2002-2004 Markus Ewald -> License.txt  // //  // #include "PythonPlugin/PythonPlugin.h" #include "PythonPlugin/Script/PythonLanguage.h" #include "Nuclex/Script/ScriptServer.h" #include "Nuclex/Kernel.h" #include "Python/Python.h" using namespace Nuclex; using namespace Nuclex::Script; namespace { //  // //  Nuclex::PythonInitTerm  // //  // /// Python global initialization class /** Initializes global DLL data. Currently includes loading D3D8.dll (which is required only once per process) and searching for the function pointer to create the main Python interface. */ class PythonInitTerm { public: /// Constructor /** Initializes global data when the dll enters a process */ PythonInitTerm() { // Initialize the Python library Py_Initialize(); Kernel::logMessage( Kernel::MT_INFO, "Python successfully initialized." ); } /// Destructor /** Destroys global data when the dll leaves a process */ ~PythonInitTerm() { Py_Finalize(); } } _PythonInitTerm; } // namespace // ############################################################################################# // // # NuclexVersion() # // // ############################################################################################# // /** Retrieve the version number of the nuclex framework the plugin was compiled against @return The framework version against which the plugin was compiled */ extern "C" NUCLEXPYTHON_API int nuclexPluginVersion() { return NUCLEX_VERSION; } // ############################################################################################# // // # NuclexRegister() # // // ############################################################################################# // /** Register the plugin to a nuclex kernel instance @param pKernel Kernel to register to */ extern "C" NUCLEXPYTHON_API void nuclexPluginRegister(Kernel *pKernel) { pKernel->getScriptServer()->addLanguage("Python", shared_ptr(new PythonLanguage())); } // ############################################################################################# // // # NuclexUnregister() # // // ############################################################################################# // /** Unregister the plugin from a nuclex kernel instance @param pKernel Kernel to unregister from */ extern "C" NUCLEXPYTHON_API void nuclexPluginUnregister(Kernel *pKernel) { pKernel->getScriptServer()->removeLanguage("Python"); }