DMD 1.005 release

Derek Parnell derek at nomail.afraid.org
Wed Feb 7 15:21:51 PST 2007


On Wed, 07 Feb 2007 11:50:50 -0800, BCS wrote:

>> No, versions defined in an import do NOT affect the importer.
> 
> What?? then how do you implement non trivial vertion logic?
> 
> version(Foo)
> {
> 	// Foo alwys needs Bar
> 	version = Bar
> 
> 	...
> }
> 
> ... more of the like

Not wishing to over promote the Bud tool, but it does implement 'global'
version statements. 

pragma(export_version):

This allows you to set a global version identifier. DMD allows you to set a
version identifier in your code, but the scope of that is only for the
module it is set in. This pragma gives you the ability to declare a version
identifier which is applied to all modules being compiled, and not just the
'current' module. 

Example: 
    version(build) pragma(export_version, Unix);
    version(build) pragma(export_version, Limited);
These lines will cause the compiler to have these version identifiers added
to the command line switches, thus making them effectively global. You can
list more than one identifier on the pragma statement ... 
    version(build) pragma(export_version, Unix, Limited);

So in your example above ...

  version(build) pragma(export_version, Foo, Bar);

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
8/02/2007 10:19:53 AM



More information about the Digitalmars-d-announce mailing list