0e63af5da3
Resolve DLL imports at CRT startup, not on demand On Windows, libstd uses GetProcAddress to locate some DLL imports, so that libstd can run on older versions of Windows. If a given DLL import is not present, then libstd uses other behavior (such as fallback implementations). This commit uses a feature of the Windows CRT to do these DLL imports during module initialization, before main() (or DllMain()) is called. This is the ideal time to resolve imports, because the module is effectively single-threaded at that point; no other threads can touch the data or code of the module that is being initialized. This avoids several problems. First, it makes the cost of performing the DLL import lookups deterministic. Right now, the DLL imports are done on demand, which means that application threads _might_ have to do the DLL import during some time-sensitive operation. This is a small source of unpredictability. Since threads can race, it's even possible to have more than one thread running the same redundant DLL lookup. This commit also removes using the heap to allocate strings, during the DLL lookups. |
||
---|---|---|
.. | ||
benches | ||
src | ||
tests | ||
build.rs | ||
Cargo.toml |