2

In an application that we are writing, we plan to allow users to execute Python scripts in one of many versions of Python (eg. Python 2.7, 3.6 etc). We use the standard method for embedding the python interpreter except that we are dynamically loading and initializing different python interpreter DLLs (python*.dll). Can different python interpreter versions coexist in the same process (i.e. can multiple python* DLLs be loaded into the same process and initialized)? Can these interfere in any way?

This question is related but not the same. The question only asks how to use multiple python interpreter versions in the same process but doesn't ask whether this is supported and expected to work.

aprasad
  • 29
  • 3
  • Too broad. Sounds like a bad idea anyway. – too honest for this site May 23 '17 at 21:53
  • A _.dll_ exposes functions (in our case) to be consumed by others (_.dll_, _.exe_, ...). How the consumer accesses the _.dll_ funcs (linking against or dynamically loading) is irrelevant. An example: [\[SO\]: What files are required for Py_Initialize to run?](https://stackoverflow.com/questions/39539089/what-files-are-required-for-py-initialize-to-run/39541474). **2nd question**: each (major, sometimes minor) _Python_ version is built with a different _VStudio_ version. Your app will have its own one, so there will be cases when more than 1 _VStudio_ runtime, will be loaded - can get messy. – CristiFati May 24 '17 at 16:13
  • Thanks Cristi. The only thing I was worried about with dynamic loading was whether there was some custom initialization code in python*.lib (which I would link to if I wasn't dynamically loading). If python*.lib is just the standard lib file generated by VC, then there is no problem as you say. – aprasad May 24 '17 at 18:54
  • There's nothing to be worried about (well except of the 2 _VStudio C_ runtimes, but I'm not sure that it'll generate problems). – CristiFati May 24 '17 at 20:22

0 Answers0