Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 20, 2014 No Output with shebang. | ||||
---|---|---|---|---|
| ||||
#!/usr/bin/gdc import std.stdio; void main() { writeln("Hello, world with automated script running!"); } When I compile the code above normal to an a.out binary it runs like expected. But running it with shebang it does nothing. No output, especially no error message. Nothing. What do I wrong? |
August 20, 2014 Re: No Output with shebang. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Newbie | On Wednesday, 20 August 2014 at 20:17:49 UTC, Newbie wrote:
> #!/usr/bin/gdc
>
> import std.stdio;
> void main()
> {
> writeln("Hello, world with automated script running!");
> }
>
> When I compile the code above normal to an a.out binary it runs
> like expected. But running it with shebang it does nothing. No
> output, especially no error message. Nothing.
>
> What do I wrong?
gdc just compiles the program to a.out. It doesn't run the
resulting executable. You need to use something like rdmd instead
of gdc. rdmd compiles to some temporary location and then runs
the executable.
|
August 20, 2014 Re: No Output with shebang. | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | On Wednesday, 20 August 2014 at 20:21:13 UTC, anonymous wrote:
> On Wednesday, 20 August 2014 at 20:17:49 UTC, Newbie wrote:
>> #!/usr/bin/gdc
>>
>> import std.stdio;
>> void main()
>> {
>> writeln("Hello, world with automated script running!");
>> }
>>
>> When I compile the code above normal to an a.out binary it runs
>> like expected. But running it with shebang it does nothing. No
>> output, especially no error message. Nothing.
>>
>> What do I wrong?
>
> gdc just compiles the program to a.out. It doesn't run the
> resulting executable. You need to use something like rdmd instead
> of gdc. rdmd compiles to some temporary location and then runs
> the executable.
Wow, that was fast. Thanks a lot!
|
August 20, 2014 Re: No Output with shebang. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Newbie | >> gdc just compiles the program to a.out. It doesn't run the resulting executable. You need to use something like rdmd instead of gdc. rdmd compiles to some temporary location and then runs the executable.
>
>
> Wow, that was fast. Thanks a lot!
Can compiler switches be used with the shebang notation? If yes, there is certainly a GDC flag (-run?) that tells it to run the generated executable.
|
August 21, 2014 Re: No Output with shebang. | ||||
---|---|---|---|---|
| ||||
Attachments: | On Wed, 20 Aug 2014 23:03:48 +0200 Philippe Sigaud via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > Can compiler switches be used with the shebang notation? If yes, there is certainly a GDC flag (-run?) that tells it to run the generated executable. it's possible to use switches, but GDC is not fitted for such usage anyway. it will not automatically compile included modules, it will not automatically put the binary in predefined place and so on. ah, dmd is not suitable for such usage too, that's why we have rdmd. rdmd can be adapted to use GDC (if compiled with GDC, rdmd will use gdmd instead of dmd), but dmd is faster and the quality of generated code is not so important in scripts. |
Copyright © 1999-2021 by the D Language Foundation