Thread overview
"version" predefined pragma
Feb 22, 2006
Dave
Feb 22, 2006
Derek Parnell
Feb 23, 2006
Victor Nakoryakov
Feb 23, 2006
Alexander Panek
February 22, 2006
Along the same lines as pragma(lib,...) I'm wondering if it would make sense to
add something like pragma(switch,...) also, e.g.:

pragma(switch,"-version=MY_VERSION");
version(Windows)
{
pragma(switch,"-L/SUBSYSTEM:windows:5");
}

That would act like the command-line:

C:\>dmd foo.d bar.d version=MY_VERSION -L/SUBSYSTEM:windows:5


February 22, 2006
On Wed, 22 Feb 2006 03:52:38 +0000 (UTC), Dave wrote:

> Along the same lines as pragma(lib,...) I'm wondering if it would make sense to
> add something like pragma(switch,...) also, e.g.:
> 
> pragma(switch,"-version=MY_VERSION");
> version(Windows)
> {
> pragma(switch,"-L/SUBSYSTEM:windows:5");
> }
> 
> That would act like the command-line:
> 
> C:\>dmd foo.d bar.d version=MY_VERSION -L/SUBSYSTEM:windows:5

You can do this sort of thing with Build.

version(build) {
    pragma(export_version, MY_VERSION);
    version(Windows) {
        pragma (build_def, "EXETYPE NT");
        pragma (build_def, "SUBSYSTEM WINDOWS,4.0")
    }
}

Though the Windows subsystem is normally handled automatically but the pragma allows you to override the standard values.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
22/02/2006 3:10:50 PM
February 23, 2006
Dave wrote:
> Along the same lines as pragma(lib,...) I'm wondering if it would make sense to
> add something like pragma(switch,...) also, e.g.:
> 
> pragma(switch,"-version=MY_VERSION");
> version(Windows)
> {
> pragma(switch,"-L/SUBSYSTEM:windows:5");
> }
> 
> That would act like the command-line:
> 
> C:\>dmd foo.d bar.d version=MY_VERSION -L/SUBSYSTEM:windows:5
> 
> 

Because there is to only dmd compiler, and there are different switches for different compilers.

-- 
Victor (aka nail) Nakoryakov
nail-mail [at] mail.ru

Krasnoznamensk, Moscow, Russia
February 23, 2006
Victor Nakoryakov wrote:
> Dave wrote:
> 
>> Along the same lines as pragma(lib,...) I'm wondering if it would make sense to
>> add something like pragma(switch,...) also, e.g.:
>>
>> pragma(switch,"-version=MY_VERSION");
>> version(Windows)
>> {
>> pragma(switch,"-L/SUBSYSTEM:windows:5");
>> }
>>
>> That would act like the command-line:
>>
>> C:\>dmd foo.d bar.d version=MY_VERSION -L/SUBSYSTEM:windows:5
>>
>>
> 
> Because there is to only dmd compiler, and there are different switches for different compilers.
> 

version(DigitalMars) {
	pragma(switch,..);
	version(...) {
		pragma(..);
	}
}

Good enough, I guess.