Load python from different plugin dlls
Thanks for the information.
My test looks like this right now.
I have two plugins which, when loaded separately, work.
But when both are loaded, I get AccessVioletion messages from python37.dll.
The init code for both dlls is this:
cpp_init_code = f'''#include <Python.h>
BOOL APIENTRY DllMain( HANDLE hModule,
LPVOID /* lpReserved */ )
switch ( reasonForCall )
Py_InitializeEx(Py_IsInitialized() ? 0 : 1);
This is written to a plugininit.cpp file and then built via setup.py with
distutil, cython and VS2017.
According to the docs PyImport_AppendInittab should be called before
but I can't call Py_Initialize the second time as it would remove what was
initialized by the first dll.
And using PyImport_ImportModule on the second dll only does not work either.
So that is were I'm trapped.
Am Do., 13. Feb. 2020 um 07:26 Uhr schrieb R.Wieser <address at not.available>:
> > which needs also access to python3.dll but cannot load it itself as it
> > been already loaded by plugin1
> > Is such a scenario actually possible?
> Normally a DLL can be loaded in as many processes (and threads thereof) as
> you like.
> However, it is possible that the DLLs initialisation contains code to
> if something it needs is available*, and if not directly exit.
> *like if it can access certain I/O - if the first DLL instance "takes
> posession" the second DLL instance wil fail. Than again, this can also
> happen when using two totally different plugin DLLs.
> Yes, but not likely.