Thread overview
Does dmd's -i "include imported modules in the compilation" switch generate object files?
Nov 03, 2020
Ali Çehreli
Nov 03, 2020
H. S. Teoh
Nov 04, 2020
Jacob Carlborg
November 03, 2020
-i is a useful feature:

  https://dlang.org/dmd-linux.html

Does dmd compile auto-included files separately? Does it generate temporary object files? If so, where does it write the files? Would -i cause race conditions on the file system?

Thank you,
Ali
November 03, 2020
On Tue, Nov 03, 2020 at 10:42:55AM -0800, Ali Çehreli via Digitalmars-d-learn wrote:
> -i is a useful feature:
> 
>   https://dlang.org/dmd-linux.html
> 
> Does dmd compile auto-included files separately? Does it generate temporary object files? If so, where does it write the files? Would -i cause race conditions on the file system?
[...]

I believe -i behaves as though you manually typed the names of the source files on the command line.  So it would do what the compiler would usually do in the latter case.

AFAIK, that means it loads everything into memory and produces only a single object file for the final executable. Separate compilation only happens if you invoke the compiler separately for each source file or group of source files.


T

-- 
We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare.  Now, thanks to the Internet, we know this is not true. -- Robert Wilensk
November 04, 2020
On 2020-11-03 20:02, H. S. Teoh wrote:

> I believe -i behaves as though you manually typed the names of the
> source files on the command line.  So it would do what the compiler
> would usually do in the latter case.

Yes, this is correct.

> AFAIK, that means it loads everything into memory and produces only a
> single object file for the final executable. Separate compilation only
> happens if you invoke the compiler separately for each source file or
> group of source files.

If the `-c` flag is passed, the compiler will produce one object file for each source file. If the `-c` flag is **not** passed, it will produce one executable and one single object file.

-- 
/Jacob Carlborg