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

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Dec 13 19:37:09 UTC 2023


Example:

```D
import std;
void main() {
   deliberate syntax error here
}
```

```bash
$ cat example.d | dmd -run -
__stdin.d(3): Error: found `error` when expecting `;` or `=`, did 
you mean `deliberate syntax = here`?
__stdin.d(3): Error: found `}` when expecting `;` or `=`, did you 
mean `error here = End of File`?
```

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"?


More information about the Digitalmars-d-learn mailing list