Used
The Used
aspect can be applied to a type or individual type member to indicate that it will be used indirectly, and should not be eliminated by the linker when it finds no direct references to it. This is commonly needed when classes are discovered and instantiated dynamically at runtime – for example by a library such as EUnit which checks all globally defined classes for unit tests to run.
Applying the Used
attribute on a type will make sure the type and all its members will be linked into the final executable.
Applying the Used
attribute on one or more members will ensure that the code and entry points for these members, and any of their dependencies, will be linked into the final executable. Note that this may or may not include the containing type itself.
Island Only
The Used
aspect is available on the Island-backed platform only.
(On legacy Cocoa, and for Cocoa classes on Island, Used
is implied, as these are never eliminated).
type
[Used]
MyProperties = public class
public
end;
[Used]
public class MyClass
{
}
@Used public class MyClass {
}
@Used public class MyClass {
}