Core Attributes
GenerateInterop
Marks a struct as a target for code generation. Required to use any other InteropGenerator features.isInherited- Set totrueif this struct will be inherited by another struct usingInherits<T>
Inherits
Indicates that a struct should inherit public fields and methods from parent typeT.
parentOffset- Explicit parent offset, overriding size-based offsetting with multiple inheritance
Function Attributes
MemberFunction
Marks a method as a stub for calling a native class member function.signature- Signature pattern resolving to the native function addressrelativeFollowOffsets- Optional array of offsets to follow relative addresses
MemberFunctionAttribute(string signature)MemberFunctionAttribute(string signature, ushort relativeFollowOffset)MemberFunctionAttribute(string signature, ushort[] relativeFollowOffsets)
- The stub method signature should match the native function’s signature
- For non-static functions, exclude the “this” argument (typically the first pointer)
- Supports static functions
- Use
??as wildcards in signatures for unknown/variable bytes
VirtualFunction
Marks a method as a stub for calling a native class virtual function.index- Native function index in the class’s virtual table
- Exclude the “this” argument from the method signature
- Requires the struct to have a virtual table pointer at offset 0
- Virtual table indices are zero-based
StaticAddress
Marks a method as a stub for returning a pointer to a static address in the native binary.signature- Signature pattern resolving to the static address referencerelativeFollowOffsets- Optional array of offsets to follow relative addressesisPointer- Set totrueif the static address is itself a pointer (avoids double pointer returns)
StaticAddressAttribute(string signature, ushort relativeFollowOffset, bool isPointer = false)StaticAddressAttribute(string signature, ushort[] relativeFollowOffsets, bool isPointer = false)
- Return type should be a pointer to the type at the static address
- Use
isPointer: truewhen the static address stores a pointer value - Commonly used for singleton instance getters
VirtualTable
Generates a static reference to the address of a native class’s virtual table.signature- Signature pattern resolving to the virtual table address referencerelativeFollowOffsets- Optional array of offsets to follow relative addressesfunctionCount- Optional count of functions in the vtable (sets the size of the generated table struct)
VirtualTableAttribute(string signature, ushort relativeFollowOffset, uint functionCount = 0)VirtualTableAttribute(string signature, ushort[] relativeFollowOffsets, uint functionCount = 0)
- Creates a nested
{StructName}VirtualTablestruct - Adds a
VirtualTablefield at offset 0 - Populates the vtable struct with function pointers based on
VirtualFunctionattributes
Field Attributes
FixedSizeArray
Marks a field as a fixed-size array, generating convenient accessors.isString- Set totrueonbyteorchararrays to generate C# string accessorsisBitArray- Set totrueonbytearrays to generate a BitArray accessorbitCount- Required bit count whenisBitArrayistrue
- Field should be
privateorinternalwith typeFixedSizeArray{N}<T> {N}is the integer size of the array- Accessors are generated with the field name minus the leading underscore
Span<T>accessor for array elements- String property when
isString: true - BitArray accessor when
isBitArray: true
BitField
Generates property accessors for individual bits or bit ranges in integer fields.name- Name of the generated propertyindex- Starting bit index (zero-based)length- Number of bits (default: 1)
- Multiple
BitFieldattributes can be applied to the same field - Generic type
Tdetermines the property type - Supports
bool,byte,ushort,uint,ulong
String Overload Attributes
GenerateStringOverloads
Generates convenient overloads for methods that take C-string (byte*) arguments.
- Automatically detects
byte*parameters that represent C-strings - Generates two overloads: one accepting
string, one acceptingReadOnlySpan<byte> - Handles UTF-8 encoding and null-termination automatically
StringIgnore
Excludes a specificbyte* parameter from string overload generation.
- A function has multiple
byte*parameters - Some pointers represent binary data, not C-strings
- You need fine-grained control over which parameters get string overloads
FFXIVClientStructs-Specific Attributes
Agent
Marks a struct as representing a UI Agent, linking it to an AgentId.Addon
Marks a struct as representing a UI Addon, specifying its identifier(s).InfoProxy
Marks a struct as an InfoProxy, linking it to an InfoProxyId.Attribute Combinations
Common attribute patterns for different scenarios:Simple struct with methods
Struct with inheritance
Singleton with static instance
Struct with virtual functions
Struct with arrays and bitfields
See Also
- Source Generators - How the InteropGenerator processes these attributes
- Address Resolver - Runtime signature scanning and address resolution
- Memory Layout Guide - Best practices for struct layout