You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$(P These are found in Druntime's $(DRUNTIMESRC rt/).)
962
+
$(P An instance of $(LINK2 https://dlang.org/phobos/object.html#.ModuleInfo, `ModuleInfo`)
963
+
is generated by the compiler and inserted into the object file for every module.
964
+
`ModuleInfo` contains information about the module that is useful to the D runtime library:
965
+
)
966
+
967
+
$(UL
968
+
$(LI If the module has a static constructor, static destructor, shared static constructor, or shared static destructor.)
969
+
$(LI A reference to any unit tests defined by the module.)
970
+
$(LI An array of references to any imported modules that have one or more of:
971
+
$(OL
972
+
$(LI static constructors)
973
+
$(LI static destructors)
974
+
$(LI shared static constructors)
975
+
$(LI shared static destructors)
976
+
$(LI unit tests)
977
+
$(LI transitive imports of any module that contains one or more of 1..5)
978
+
$(LI order independent constructors (currently needed for implementing
979
+
$(DDSUBLINK dmd, switch-cov, $(TT -cov))))
980
+
)
981
+
This enables the runtime to run the unit tests,
982
+
the module constructors in a depth-first order,
983
+
and the module destructors in the reverse order.
984
+
)
985
+
986
+
$(LI An array of references to `ClassInfo` for each class defined in the module.
987
+
$(NOTE this feature may be removed.))
988
+
)
989
+
990
+
$(P `ModuleInfo` is defined in Druntime's $(DRUNTIMESRC object.d), which must match the compiler's output in both the values of flags and layout of fields.)
991
+
992
+
$(P Modules compiled with $(DDSUBLINK dmd, switch-betterC, $(TT -betterC))
993
+
do not have a `ModuleInfo` instance generated, because such modules must work
994
+
without the D runtime library.
995
+
Similarly, $(DDLINK spec/importc, ImportC, ImportC) modules do not generate a `ModuleInfo`.
996
+
)
963
997
964
-
$(H2 $(LNAME2 module_init_and_fina, Module Initialization and Termination))
998
+
$(H3 $(LNAME2 module_init_and_fina, Module Initialization and Termination))
965
999
966
1000
$(P All the static constructors for a module are aggregated into a
967
1001
single function, and a pointer to that function is inserted
968
-
into the ctor member of the ModuleInfo instance for that
1002
+
into the ctor member of the `ModuleInfo` instance for that
969
1003
module.
970
1004
)
971
1005
972
1006
$(P All the static destructors for a module are aggregated into a
973
1007
single function, and a pointer to that function is inserted
974
-
into the dtor member of the ModuleInfo instance for that
1008
+
into the dtor member of the `ModuleInfo` instance for that
975
1009
module.
976
1010
)
977
1011
978
-
$(H2 $(LNAME2 unit_testing, Unit Testing))
1012
+
$(H3 $(LNAME2 unit_testing, Unit Testing))
979
1013
980
1014
$(P All the unit tests for a module are aggregated into a
981
1015
single function, and a pointer to that function is inserted
982
-
into the unitTest member of the ModuleInfo instance for that
1016
+
into the unitTest member of the `ModuleInfo` instance for that
0 commit comments