# RCOM Specification

### ● Introduction

RCOM is a methodology for plugin frameworks which is similar to microsoft COM. The main feature of RCOM is that any object can subclass|override|hook any RCOMObject at runtime. Within RCOM, the contract (interface) is method ids. They are fixed for a given interface. Once published, they cannot be changed. To update interface, the component writer have to create new version of the interface. Unlike COM, invoke method of the RCOMObject can be overriden by another object. In that case, the entire method invocation messages will be dispatched to the new object. This new object can decide which messages it will responds and which are not. Also it can act like a hook receiver to get a notification on method invocation. This overriding mechanism introduces inheritance and polymorphism capabilities at runtime for binary components.

### ● Methodology

Everything begins with RCOMObject interface. The definition of RCOMObject interface is illustrated in following code fragment. It defines ten methods, some are taken from IUnknown and IDispatch interfaces of COM.

    interface RCOMObject
    {
       int AddRef();
       int Release();
       GUID* GetClassID();
       int GetInterfaceIndex(const GUID *interfaceID);
       int GetTypeInfo(int interfaceIndex, int methodID, int paramIndex);
       int _GetTypeInfo(int interfaceIndex, int methodID, int paramIndex);
       int Invoke(int interfaceIndex, int methodID, void **params, int nparam, void *retval);
       int _Invoke(int interfaceIndex, int methodID, void **params, int nparam, void *retval);
       void OverrideInvoke(RCOMObject *newObject);
       bool SetParent(RCOMObject *parent);
    }