www.digitalmars.com         C & C++   DMDScript  

D.gnu - Support of -run and source code from stdin

reply Andre Pany <andre s-e-a-p.de> writes:
Hi,
Dmd and ldc supports running source code from stdin:

```
echo 'void main(){}' | dmd -run -
```

It seems GDC does not support argument -run and I do not know 
wheter it supports reading source code from stdin?

Could this 2 featured be added to gdc?
This would solve the probe file issue mentioned here 
https://forum.dlang.org/post/uwxndbpxspwaofolksbr forum.dlang.org

Kind regards
Andre
May 27 2020
parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On Wednesday, 27 May 2020 at 21:40:38 UTC, Andre Pany wrote:
 Hi,
 Dmd and ldc supports running source code from stdin:

 ```
 echo 'void main(){}' | dmd -run -
 ```

 It seems GDC does not support argument -run and I do not know
I see no obvious use for having something like -run in the driver. Toolchain apps are more than capable of doing this themselves.
 wheter it supports reading source code from stdin?
gdc -x d - The -x tells gcc what language to parse, as the driver is capable of handling all languages gcc knows about, eg -xc++.
 Could this 2 featured be added to gdc?
 This would solve the probe file issue mentioned here 
 https://forum.dlang.org/post/uwxndbpxspwaofolksbr forum.dlang.org
Looks like the description of the problem matches what this PR is fixing. https://github.com/dlang/dub/pull/1941 Iain
May 27 2020
parent Andre Pany <andre s-e-a-p.de> writes:
On Thursday, 28 May 2020 at 04:58:26 UTC, Iain Buclaw wrote:
 On Wednesday, 27 May 2020 at 21:40:38 UTC, Andre Pany wrote:
 Hi,
 Dmd and ldc supports running source code from stdin:

 ```
 echo 'void main(){}' | dmd -run -
 ```

 It seems GDC does not support argument -run and I do not know
I see no obvious use for having something like -run in the driver. Toolchain apps are more than capable of doing this themselves.
 wheter it supports reading source code from stdin?
gdc -x d - The -x tells gcc what language to parse, as the driver is capable of handling all languages gcc knows about, eg -xc++.
 Could this 2 featured be added to gdc?
 This would solve the probe file issue mentioned here 
 https://forum.dlang.org/post/uwxndbpxspwaofolksbr forum.dlang.org
Looks like the description of the problem matches what this PR is fixing. https://github.com/dlang/dub/pull/1941 Iain
Thanks for the info. The issue is not about the compiled artifacts but about the probe modules (source code). In some cases, they are not deleted (There is a module destructor in dub which should take care of). Kind regards André
May 28 2020