In the parlance of posix and general technical software development. Does an import
of a purely python ( not cython or c compiled libraries ) module constitute a dynamic linking?
No, loading a pure-Python module is not considered a form of dynamic linking.
Traditional dynamic linking loads machine code into a new chunk of memory, and multiple executable processes can be given access (the dynamically linked library only needs to be loaded once, virtual memory takes care of the rest). The linker connects the executable and the dynamic library at runtime.
Loading a Python module, on the other hand, loads the bytecode for the modules into the Python process itself (Python will compile the source code if no bytecode cache is available at this time too). The loaded modules are not shared between processes. No translation has to take place, the result of running the bytecode produces new objects in the Python heap that all existing code in the interpreter can interact with.
No linker is involved in this process, no separate memory, to the OS there are no separate sections of memory to be managed as the module is simply part of the Python process memory.
import
statement uses the __import__()
hook to do its work. –
Gangplank import
statement and __import__()
function belonging to en.wikipedia.org/wiki/Dynamic_loading or en.wikipedia.org/wiki/Dynamic_linking? If neither, what are they belong to, or which one are they more close to? –
Supplicate © 2022 - 2024 — McMap. All rights reserved.