Module without object file?
Steven Schveighoffer
schveiguy at gmail.com
Fri Jan 7 16:09:11 UTC 2022
On 1/6/22 6:06 PM, kdevel wrote:
>> When you import this file, the compiler sees that it has imports, and
>> assumes you must have built the `ModuleInfo` in some object somewhere,
>> so it outputs a reference for the import graph.
>
> Makes sense. It seems that if there are just type definitions with enum
> constants the module is a "leaf module". As soon as I add the delegate
> which calls writefln
>
> ```somemodule.d
> struct File {
> enum title = "File";
> enum void function (string) foo = (a => writefln ("a <%s>", a));
> }
> ```
>
> to the source the linker complains about the missing ModuleInfo.
The reasons the compiler decides to require `ModuleInfo` are somewhat
unspecified. I would have expected just importing std.stdio would do it,
but maybe you have to actually use something from that module.
-Steve
More information about the Digitalmars-d-learn
mailing list