Is it possible to set/override the name of the source file when piping it into DMD via stdin?

Adam D Ruppe destructionator at gmail.com
Wed Dec 13 19:51:11 UTC 2023


On Wednesday, 13 December 2023 at 19:37:09 UTC, Siarhei Siamashka 
wrote:
> Now I'm curious. Is it possible to somehow communicate the real 
> source file name to `dmd`, so that it shows up in the error log 
> instead of "__stdin.d"?

the sequence `#line "filename.d" 1` at the top of the thing might 
do what you need.

https://dlang.org/spec/lex.html#special-token-sequence

might also suggest putting a `module` declaration in the file.


More information about the Digitalmars-d-learn mailing list