Thread overview | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 14, 2021 Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Why Compiler Writers Accept instructions for the compiler as compiler switches rather than through the source code. What's wrong with providing options like "L/SUBSYSTEM:WINDOWS" through the source code? |
February 14, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vinod K Chandran | On Sunday, 14 February 2021 at 07:56:43 UTC, Vinod K Chandran wrote: > Why Compiler Writers Accept instructions for the compiler as compiler switches rather than through the source code. What's wrong with providing options like "L/SUBSYSTEM:WINDOWS" through the source code? You are in luck, dmd does provide support for this... https://dlang.org/spec/pragma.html#linkerDirective ... and it's wonderful, I wish all compilers followed suit. |
February 14, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vinod K Chandran | https://dlang.org/spec/pragma.html#linkerDirective |
February 14, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vinod K Chandran | On 2/13/2021 11:56 PM, Vinod K Chandran wrote: > Why Compiler Writers Accept instructions for the compiler as compiler switches rather than through the source code. What's wrong with providing options like "L/SUBSYSTEM:WINDOWS" through the source code? There are a couple pragmas that do it https://dlang.org/spec/pragma.html#linkerDirective but people generally prefer to do those with their build system. |
February 14, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Sunday, 14 February 2021 at 08:41:15 UTC, kinke wrote:
> https://dlang.org/spec/pragma.html#linkerDirective
Thanks @kinke. Let me check.
|
February 14, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Sunday, 14 February 2021 at 08:59:32 UTC, Walter Bright wrote:
> On 2/13/2021 11:56 PM, Vinod K Chandran wrote:
>> Why Compiler Writers Accept instructions for the compiler as compiler switches rather than through the source code. What's wrong with providing options like "L/SUBSYSTEM:WINDOWS" through the source code?
>
> There are a couple pragmas that do it https://dlang.org/spec/pragma.html#linkerDirective but people generally prefer to do those with their build system.
Thanks @ Walter Bright
So I can write like this --
pragma(linkerDirective, "L/SUBSYSTEM:WINDOWS")
Am i right ? If so, i would like to know more about like which compiler switches are allowed to use with pragmas.
|
February 14, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vinod K Chandran | On 2/14/2021 8:58 AM, Vinod K Chandran wrote: > So I can write like this -- > pragma(linkerDirective, "L/SUBSYSTEM:WINDOWS") > Am i right ? yes > If so, i would like to know more about like which compiler switches are allowed to use with pragmas. https://dlang.org/spec/pragma.html The linkerDirective, however, is for linker switches. |
February 15, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Sunday, 14 February 2021 at 22:26:54 UTC, Walter Bright wrote: > On 2/14/2021 8:58 AM, Vinod K Chandran wrote: > > yes > Thanks for the reply. > https://dlang.org/spec/pragma.html > I had already read that page. > The linkerDirective, however, is for linker switches. > I would like to know how compiler switches like "-i", "-j" are using in "pragma" |
February 15, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vinod K Chandran | On Monday, 15 February 2021 at 07:32:06 UTC, Vinod K Chandran wrote:
>>
> I would like to know how compiler switches like "-i", "-j" are using in "pragma"
There is no pragma for those switches.
|
February 15, 2021 Re: Compiler switches in source code | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vinod K Chandran | On Sunday, 14 February 2021 at 07:56:43 UTC, Vinod K Chandran wrote: > Why Compiler Writers Accept instructions for the compiler as compiler switches rather than through the source code. What's wrong with providing options like "L/SUBSYSTEM:WINDOWS" through the source code? I think rund [1] offers what you're looking for. Give it a try and let us know what you think! [1]: https://github.com/dragon-lang/rund |
Copyright © 1999-2021 by the D Language Foundation