Jump to page: 1 2
Thread overview
Compiler switches in source code
Feb 14, 2021
Vinod K Chandran
Feb 14, 2021
Daniel N
Feb 14, 2021
kinke
Feb 14, 2021
Vinod K Chandran
Feb 14, 2021
Walter Bright
Feb 14, 2021
Vinod K Chandran
Feb 14, 2021
Walter Bright
Feb 15, 2021
Vinod K Chandran
Feb 15, 2021
Mike Parker
Feb 15, 2021
Vinod K Chandran
Feb 15, 2021
Vinod K Chandran
Feb 15, 2021
Vinod K Chandran
Feb 16, 2021
Jonathan Marler
February 14, 2021
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
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
https://dlang.org/spec/pragma.html#linkerDirective
February 14, 2021
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
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
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
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
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
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
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
« First   ‹ Prev
1 2