[python-win32] PythonScript, unloading the Python engine

Johan Lindvall johan.lindvall at gmail.com
Mon Aug 28 12:23:10 CEST 2006


Hi,

Is it possible to (forcibly) unload the python engine after executing
a python script?

I would like to have the Dlls unloaded after Release in the following code:

#define WINVER 0x400
#define _WIN32_WINNT 0x400

#include <windows.h>
#include <ObjBase.h>
#include <activscp.h>

int main(int argc, char* argv[])
{
  CoInitializeEx(0, COINIT_APARTMENTTHREADED);
  GUID clsid;

  HRESULT hr = CLSIDFromProgID( L"Python", &clsid );

  IUnknown* tmp = 0;
  if (S_OK == hr) hr = CoCreateInstance(clsid, NULL,
CLSCTX_INPROC_SERVER, IID_IActiveScript, (void **)&tmp);
  if (tmp) tmp->Release(); // python still loaded at this point?

  return 0;
}

Thanks

-- 
/Johan.


More information about the Python-win32 mailing list