struct st_LXtGUID

GUIDs are structures containing 128 bits of pure noise, hopefully unique throughout all time and space. They are used to identify interfaces and object classes.

Public Members

unsigned int x4
unsigned short x2[2]
unsigned char x1[8]
typedef void *LXtObjectID

An object is a pointer. The first element of the pointer is the vTable, so an object of type IUnknown (all COM objects) is a pointer to a pointer to the IUnknown vTable.

typedef unsigned int LXtID4

An ID code is a 32-bit word, with values constructed by passing four characters to the macro below.

  • LXxID4

LXxMETHOD(rv, fn)

This is the IUnknown interface. In COM terminology, an “interface” describes the layout of a table containing method function vectors, or “vTable.” Three functions at the start of all COM object vTables control polymorphism and reference counting. The LXxMETHOD macro allows us to control the function declaration across different systems or compilers, although it is just the default for now.


class ILxObject

COM objects are relative black boxes; They are passed around as ILxUnknown objects, and only become more descriptive and useful when queried for an interface. Often it can be helpful for clients to be able to perform basic interaction with the COM object, without knowing which interfaces it implements. The ILxObject interface is implemented by all COM objects. It provides methods for querying the object name, as well as enumerating over interfaces implemented by the COM interface.

Public Functions

LxResult Identifier(LXtObjectID self, const char **id)

Returns the identifier of the COM object.

LxResult InterfaceCount(LXtObjectID self, unsigned int *count)

Returns the number of interfaces implemented by the object.

LxResult InterfaceByIndex(LXtObjectID self, unsigned int index, const LXtGUID **guid)

Returns the GUID of an interface specified by index.

void AddObserver(LXtObjectID self, LXtObjectID visitor)

Attach a visitor to the lifetime of the COM object. When the reference count of the COM object reaches zero, and the object is destroyed, the Evaluate method on the visitor will be called.

void RemoveObserver(LXtObjectID self, LXtObjectID visitor)

Detaches the visitor from tracking the lifetime of the COM object.


class ILxGUIDService

Public Functions

const LXtGUID *Translate(LXtObjectID self, const char *guidStr)

A service interface for converting between GUID strings and LXtGUID structs is exported as part of the application global.

  • Translate takes a GUID string (either the LXu_* long format or an LXa_* alias) and returns a pointer to an LXtGUID. The returned pointer is non-volatile and can be stored.

  • GetName takes a pointer to an LXtGUID struct and returns the name for the GUID. This will be the short alias for the GUID if it exists.

  • Compare takes two LXtGUID pointers and returns a ranking metric for sorting them. The result is similar to strcmp().

  • Fixed takes a GUID pointer that may be volatile and returns a non-volatile version from the global pool.

  • Class takes a GUID pointer and returns the class GUID, if any.

  • ClassName takes a GUID pointer and returns the name for the class, if any.

const char *GetName(LXtObjectID self, const LXtGUID *guid)
int Compare(LXtObjectID self, const LXtGUID *guid1, const LXtGUID *guid2)
const LXtGUID *Fixed(LXtObjectID self, const LXtGUID *guid)
const LXtGUID *Class(LXtObjectID self, const LXtGUID *guid)
const char *ClassName(LXtObjectID self, const LXtGUID *guid)


Crazy-ass Mac code needed to define LXx_OVERRIDE, which doesn’t need to be part of the public docs.