Initialise type from address
27 September 2023 at 12:57
I want to initialise a type from a System.address
. For example :
generic
type T_Generic is private;
package MyPackage is
G_Addr : System.Address;
procedure Register (myAddr : System.address);
procedure MyProcedure (myAddr : System.address);
end MyPackage;
package body MyPackage is
procedure Register(myAddr : System.address)
is
G_Addr := myAddr;
end MyProcedure;
procedure MyProcedure (myAddr : System.address)
myVar : T_Generic with address => myAddr;
is
if (myAddr = G_Addr)
then
-- work with myVar
end if;
end MyProcedure;
end MyPackage;
But I cannot compile this piece of code myVar : T_Generic with address => myAddr;
:
aspect specification is an Ada 2012 feature
unit must be compiled with -gnat2012 switch
I cannot change compilation's options, how can I do ?