Sujet : Re: C23 thoughts and opinions
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 04. Jun 2024, 12:35:43
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3mu6f$ct28$4@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
User-Agent : Mozilla Thunderbird
On 04/06/2024 03:12, Lawrence D'Oliveiro wrote:
On Mon, 3 Jun 2024 11:13:32 +0100, bart wrote:
So how does importlib manage to import importlib before importlib
itself is imported?
I guess the same way a linker manages to link itself.
There is NO ahead-of-time linking of modules in Python as it is
understood in traditional compiled languages.
Python is a compiled language.
CPython does ahead-of-time compilation to bytecode, of individual modules on-demand. There is no AOT compilation of all modules to binary bytecode files which need a linking process before execution starts.
It is utterly different from the linkers used with typical C code.
In the past I have written interpreters that had a discrete bytecode compiler that produced individual files per module containing binary bytecode.
The loading process was handled by the interpreter, a separate program, that fixed things up to allow the program to be run immediately; the output was not another monolithic binary file.
Again this is very different from a traditional linker that combines .o, .a, .lib and .dll files into a single executable.
(With .dll files, they are only used to build import tables of the executable; the library says separate.)