Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When you link with the WinGate SDK your module will automatically be linked with all Qbik public interfaces as they are published by their respective components. You obviously cannot use these interfaces until they are published so the Notify mechanism is present to allow you to receive a message when a new interface is registered and able to be used. The sequence typically goes as follows:

 

  1. A dependent dependency component registers an Interface with RegisterInterface
  2. The framework calls the ComponentEntry.Notify callback for your component previously registered with RegisterComponent
  3. In the Notify callback, you act on notification of this interface

...

The ComponentEntry.Notify callback in conjunction with the ComponentEntry.QueryInitInterfaces callback can work as a way to hold off initialisation of your own interfaces. To do this, have your QueryInitInterfaces callback return false until all dependent interfaces have been registered. e.g.

 

 

Code Block
languagecpp
/*
	NOTE: Pointers to the QueryInitInterfaces and Notify functions are set in your ComponentEntry which is registered with RegisterComponent
*/
 
bool QueryInitInterfaces(ComponentEntry* Entry, bool bLastChance)
{
	return hasComms && hasPersistence;
}


 
int Notify(DWORD dwWhat, ComponentEntry* Entry, void* pData)
{
	if(dwWhat != COMPONENT_NOTIFY_NEWINTERFACE)
	{
		return 0;
	}

	ComponentInterfaceEntry* pInterface = (ComponentInterfaceEntry*)pData;
	if(IsEqualGUID(pInterface->guid, HOST_COMMS_INTERFACE_UUID))
	{
		hasComms = true;
		return 0;
	}
	if(IsEqualGUID(pInterface->guid, PERSISTENCE_PROVIDER_INTERFACE_UUID))
	{
		hasPersistence = true;
		return 0;
	}
}

In the above example, once the host comms and persistence provider interfaces have been registered, your component will return true from ComponentEntry.QueryInitInterfaces and the framework then knows it can safely call your ComponentEntry.InitInterfaces callback.

See Also

ComponentEntry