Special Attributes for Island
In addition to normal Custom Attributes on Island, the Elements compiler provides support for the special, predefined attribute classes, resulting in specific code or data generated in the executable to to adjust the compiler behavior.
These attributes or aspects are available for the Island platform only. They're defined in the Island RTL.
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.
- Copyright: String
- Description: String
- FileVersion: String
- CompanyName: String
- ProductName: String
- LegalTrademarks: String
- Title: String
- 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, it's 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 blcok 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.
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')).
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 it's first parameter will pass via EAX instead of on the stack.
Can be set on a static field, when set this field will have it's 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.
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.
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.
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.
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.
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.
Changes the packing of the struct from the platform default to byte aligned.