Hamish_Fernsby
Hamish_Fernsby

Reputation: 578

Enabling Delphi XE projects to run in earlier versions - uses naming & project options

could anyone remind me what is the trick to allow earlier versions of Delphi (2010 for example) to accept units written in later versions which have the domain.sub-domain naming system like

    // Delphi XE2 & later version (comment out for 2010 & earlier):
      uses
        Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,system.Classes, Vcl.Graphics,
        Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons,
        Vcl.ExtCtrls, Vcl.ComCtrls, System.Math;

as opposed to the D2010 & earlier convention

    // Delphi 2010 & earlier version (comment out for XE2 & later):
      uses
        Windows, Messages, SysUtils, Variants, Classes, Graphics,
        Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, Math;

I know there's something you can do in project>options but can't find it & haven't been able to find earlier forum posts on the subject..

Upvotes: 1

Views: 1447

Answers (1)

David Heffernan
David Heffernan

Reputation: 612924

You cannot do that. Versions of Delphi that pre-date unit scope names cannot understand them. The standard mechanism to write single source code for Delphi versions that span the unit scope names change is to use conditional compilation.

What is available is a compatibility tool in the other direction. The name space alias features allows newer versions to understand uses clauses that omit unit scope names.

Upvotes: 6

Related Questions