Embedding Python on Windows: why does it have to be a DLL?

后端 未结 4 602
庸人自扰
庸人自扰 2020-12-30 09:49

I\'m trying to write a software plug-in that embeds Python. On Windows the plug-in is technically a DLL (this may be relevant). The Python Windows FAQ says:

4条回答
  •  粉色の甜心
    2020-12-30 10:20

    On *nix, all shared objects in a process, including the executable, contribute their exported names into a common pool; any of the shared objects can then pull any of the names from the pool and use them as they like. This allows e.g. cStringIO.so to pull the relevant Python library functions from the main executable when the Python library is statically-linked.

    On Windows, each shared object has its own independent pool of names it can use. This means that it must read the relevant different shared objects it needs functions from. Since it is a lot of work to get all the names from the main executable, the Python functions are separated out into their own DLL.

提交回复
热议问题