Module without object file?

kdevel kdevel at vogtner.de
Thu Jan 6 23:06:50 UTC 2022


On Thursday, 6 January 2022 at 02:47:17 UTC, Steven Schveighoffer 
wrote:
> Possibly. You see, you are importing another module. Since you 
> are doing that, the module must participate in cycle detection 
> at the beginning of running the program.

IC. Had cyclic module dependencies twice within this project.

> The way D does this is to store the import graph inside a 
> `ModuleInfo` struct stored in the object.
>
> 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.


More information about the Digitalmars-d-learn mailing list