[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.4.4 Interface Versions

Unlike COM, SCF supports interface versions. That is, a shared class could implement version 0.3.6 of given interface, and if client requests that interface of a version lower or equal than 0.3.6, a correct interface pointer is returned. For this to work you need to define inside each interface header file (typically named `iInterfaceName') a constant called `VERSION_iInterfaceName' that defines the current version of given interface. To correctly support different versions of interfaces you should follow these guidelines:

The possible range for major and minor version numbers is 0..255, and the range for micro version number is 0..65535.

When you query an interface, you should always tell it what interface version are you looking for. If a module cannot provide an interface compatible with the requested version, then QueryInterface() will return `NULL' (same as if interface wasn't available at all). You can use scfCompatibleVersion() to check whether the requested version is compatible with interface version. In fact, the SCF_IMPLEMENTS_INTERFACE() and SCF_IMPLEMENTS_EMBEDDED_INTERFACE() macros employ this function.

For easier definition of versioned interfaces you can use the SCF_VERSION() macro.

 
SCF_VERSION(MyGraphics3D, 0, 0, 1);

struct MyGraphics3D : public iBase
{
  ...
}


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html