Special Attributes for Island
In addition to normal Custom Attributes and Predefined Aspects and Attributes provided by the compiler, the Elements compiler provides support for the special, attribute classes defined by the low-level Island RTL. In many cases, these attributes result in specific code or data to be generated in the executable, or in changed the compiler behavior.
Windows only: Defines the parameters for the PE version resource. Assembly level attribute, has these properties which are the direct equivalent to their version property.
property Copyright: String property Description: String property FileVersion: String property CompanyName: String property ProductName: String property LegalTrademarks: String property Title: String property Version: String
For low level targets, this places a static field to be equivalent to a memory address, when reading from it or writing to it, it will directly write to that memory address. Takes 1 IntPtr parameter containing the memory address.
When defined on an external method, its body becomes a pure inline asm function. This attribute takes 4 parameters: asm containing the AT&T style asm. Constraints containing a clang compatible constraints string. SideEffects boolean to define if the asm block has side effects and align if it needs to be aligned.
For i386 only, ignored on all other CPU types. Overrides the calling convention, takes 1 parameter of type CallingConvention and can be Default, FastCall, Stdcall or Cdecl.
CallingConventionfor more information.
Overrides the name of a method or static field, takes a string parameter. By default Island uses name mangling to ensure methods don't have the same name, with this attribute a custom name can be provided. Useful for interop with other languages. Note that the compiler still applies some rules like adding an underscore before it, or adding @number after it for stdcall on Windows, these rules can be overriden by prefixing the symbol name with ascii character 1 (SymbolName(#1'MySymbol')).
SymbolNamefor more information.
When applied to a method all optimizations in that function are disabled, even if the project is optimized.
When applied to a method, this won't be inlined by the optimizer.
i386 only, ignored elsewhere. Can be set on a method, in which case its first parameter will pass via EAX instead of on the stack.
Can be set on a static field, when set this field will have its own copy for every thread instead of being a static.
Overrides the PE/ELF section a method or field will be defined in. Takes a string parameter containing the new section name.
Marks a method as not returning for optimization purposes.
NoReturnfor more information.
Marks a method or field as weak. When the linker encounters weak symbols it will merge them instead of fail, and a non weak version will take prescendence over a weak one.
Like Weak, but linkonce symbols can be discarded if they are not referenced.
LinkOncefor more information.
Can be applied to a type, method or static field and forces the compiler to link this symbol in, even if it's not referenced.
Usedfor more information.
When set on a method no prologue/epilogue, like a stackframe will be emitted for this method. Generally only combined with asm.
For all platforms, imports a symbol from the given dynamic library. Takes a dllname as a parameter. Optionally an EntryPoint named argument can be set to define which symbol to look for.
DllImportfor more information.
For all platforms, exports a method, static field or type from the given dynamic library. This can also be set globally by setting the ExportAllTypes option. When used on methods or fields, the SymbolName attribute can be used to override the name which it gets exported with.
DllExportfor more information.
Changes a struct to work like a union, all fields are located at offset 0 and overlap eachother. The size of the struct is the size of the largest field.
Unionfor more information.
Changes the packing of the struct from the platform default to byte aligned.
Packedfor more information.