diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 15:47:56 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 15:47:56 -0500 |
| commit | 7ec7511da0e2c1b8a47d2b920106d4dc67cbb3a7 (patch) | |
| tree | 797236f73f0bf04053ce39e71110a0f8c75de07c /runtime/src/pe_loader.cpp | |
| parent | 556fc4a1db007067d17eb90d3e014231243f0a00 (diff) | |
| parent | da499ab9113015ba91c2218895abc51f0aa4baf3 (diff) | |
Merge pull request #140 from IAmNotSiob
Diffstat (limited to 'runtime/src/pe_loader.cpp')
| -rw-r--r-- | runtime/src/pe_loader.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp index caf5f0ad5..a0198c033 100644 --- a/runtime/src/pe_loader.cpp +++ b/runtime/src/pe_loader.cpp | |||
| @@ -67,14 +67,16 @@ Module& Loader::load(const std::filesystem::path& image) { | |||
| 67 | std::string key = lower(image.filename().string()); | 67 | std::string key = lower(image.filename().string()); |
| 68 | if (auto it = by_name_.find(key); it != by_name_.end()) return *it->second; | 68 | if (auto it = by_name_.find(key); it != by_name_.end()) return *it->second; |
| 69 | Module& m = map_image(image); | 69 | Module& m = map_image(image); |
| 70 | bind_imports(m); | 70 | bind_imports(m); // loads every bundled module m imports first, so they land in init_order_ before m |
| 71 | protect_sections(m); | 71 | protect_sections(m); |
| 72 | init_order_.push_back(&m); | ||
| 72 | return m; | 73 | return m; |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | void Loader::initialise() { | 76 | void Loader::initialise() { |
| 76 | // order_ is dependency order: a module is pushed after the modules it imports. | 77 | // Not order_: map_image pushes a module there before bind_imports maps its dependencies, so order_ lists an |
| 77 | for (auto* m : order_) initialise(*m); | 78 | // importer ahead of the DLLs it imports. init_order_ is filled once a module's imports are all loaded. |
| 79 | for (auto* m : init_order_) initialise(*m); | ||
| 78 | } | 80 | } |
| 79 | 81 | ||
| 80 | void Loader::initialise(Module& m) { | 82 | void Loader::initialise(Module& m) { |