Backstage Work

The last line in an object definition is the ObjectEnd macro, the most important macro of ObjAsm. This is where the real OO work begins.
For each defined object, a metadata structure is created in the data segment that contains the entire object data. This structure contains the object template, the DMT, IDs and dispatch data. The first element in this structure is a pointer to the next object metadata, building a chain that starts with the pointer called p1stOMD. The last object metadata holds a NULL in this place indicating that it is the last element in the chain.
The chain can be extended with loaded objects from a DLL.
The returned value in the rax/eax register is the pointer to this memory block containing the object instance.
The first data of the object instance is a pointer to the Dual Method Table. This table consists of two different structures.
The first, with positive offsets from the DMT pointer, is the Interface Method Table (IMT), which is compatible with the COM specification.
The second structure, with negative offsets, is the Virtual Method Table (VMT) used to store the remaining virtual method addresses.
This construct allows the simultaneous use of both tables. Inheritance and polymorphic properties are guaranteed independently of both method tables.