[Issue 23974] A ModuleInfo in a separate Windows DLL should not be referred to by MIimportedModules

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 6 17:42:15 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23974

Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario at gmx.de

--- Comment #6 from Rainer Schuetze <r.sagitario at gmx.de> ---
I don't think this issue is a real problem:

- it's not easy to create DLLs with cyclic import dependencies, and even if you
manage to do it, the system won't load them AFAICT.

- so DLLs already have a "higher level" ordering that respects the required
module initializer order

- static initializers already contain a check to avoid multiple executions, so
it is no problem that it might get called across DLL boundaries, it just does
nothing.

The actual difficulty is that the dependency between modules is part of the
ModuleInfo and needs a data relocation through the import table. This is not
supported by the OS. https://github.com/dlang/dmd/pull/14849 solves this
similar to LDC by running some initializers before most of the C runtime is
started. This is needed for other data entries as well (e.g. TypeInfo), so it
does not help a lot to avoid it for ModuleInfo.

--


More information about the Digitalmars-d-bugs mailing list