- changed status to resolved
XE5 Compiler warning re: injected attribute
Receiving the following warning from XE5, building for W32:
[dcc32 Warning] Dap.Control.pas(13): W1000 Symbol 'InjectAttribute' is deprecated: 'Use Spring.Container.Common.InjectAttribute'
This isn't giving me any issues, just trying to understand what the warning is telling me and how to correct my code to lift the warning.
I've included in the interface portion of the unit where the error is occurring; there are three instances of the warning.
uses DAPLib_TLB, Dap.Interfaces, Spring.Container, Spring.Container.Common, Spring.Services;
const
CMaxADCount = 32767;
CMinADCount = -32768;
type
TDapControl = class(TInterfacedObject, IDapControl)
private
[Inject]
FDapInterface : IDapInterface;
[Inject(CMaxADCount)]
FMaxADCount : integer;
[Inject(CMinADCount)]
FMinADCount : integer;
function GetDapName: string;
procedure SetDapName(aValue: string);
procedure SetOnNewBinaryData(aValue: TDAPNewBinaryData);
function GetOnNewBinaryData: TDapNewBinaryData;
procedure SetOnNewTextData(aValue: TDAPNewTextData);
function GetOnNewTextData: TDapNewTextData;
public
constructor Create(aDap : IDapInterface; aMaxADCount : integer; aMinADCount : integer);
function MaxAdCount : integer;
function MinAdCount : integer;
function GetDAPData(aLength: integer; var aBuffer : smallint): integer;
function Stop_DAP: boolean;
function Reset_DAP: boolean;
function Flush_DAP: boolean;
function DapPresent: boolean;
function Get_Dap_Var(DapVar : string): string;
procedure Set_Dap_Var(DapVar : string; Value : integer);
procedure Send_DAPL_Command(aCommand : string);
procedure ReleaseDAP;
function CheckInRange(aADValue: integer): integer;
function ConvertDtoA(aDigitalVal : integer; aAtoDRange : double): double;
function ConvertAToD(aFloatVal : double; aAtoDRange : double): integer;
procedure ConvertAToDandSend(aFloatVal : double; aAtoDRange : double; aDapVarName : string);
procedure SendStringToDAP(aString : string);
procedure SendCCFileToDAP(aFilename : string);
procedure SendDaplFileToDap(aFilename: string);
property DapName: string read GetDapName write SetDapName;
property OnNewBinaryData : TDAPNewBinaryData read GetOnNewBinaryData write SetOnNewBinaryData;
property OnNewTextData : TDAPNewTextData read GetOnNewTextData write SetOnNewTextData;
end;
procedure RegisterDapControl(aUseHardware : boolean=true);
function GetADAP: IDapControl;
This was my first foray into field injection. I'm happy to post more sample code if you think it would be helpful.
Thanks,
Ryan
Comments (5)
-
repo owner -
reporter Stefan, there is more to it that that. My procedure RegisterDapControl is utilizing the GlobalContainer to register a couple types. Spring.Container is needed in the uses for that. Moving the Spring.Container down to the implementation uses didn't cause any affect on the compiler warning.
-
repo owner And what about Spring.Services?
-
reporter That got it. I don't seem to be needing Spring.Services in my uses! Thanks Stefan.
-
repo owner - changed version to 1.2
- Log in to comment
This is easy: only use Spring.Container.Common in your uses