I've got it working now, but if anyone's curious about what I'm using, here's some code:
In the interface's header:
Code:
#define INTERFACEVERSION_MYINTERFACE "MyInterface001"
In the implementation's cpp file:
Code:
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CMyImplementation, IMyInterface, INTERFACEVERSION_MYINTERFACE, g_MySingleton);
In the plugin's cpp file (g_MySingleton is externed from the implementation's object file):
Code:
void *CreateInterfaceHook(const char *pName, int *pReturnCode)
{
if (Q_strcmp(pName, INTERFACEVERSION_MYINTERFACE) == 0)
{
if (pReturnCode != NULL)
* pReturnCode = IFACE_OK;
FACTORY_RETURN(MRES_SUPERCEDE, (void *) g_MySingleton);
}
FACTORY_RETURN(MRES_IGNORED, NULL);
}
And then in my plugin's Load() function:
Code:
list->server = CreateInterfaceHook;
Then I tested it in AllPluginsLoaded():
Code:
IMyInterface *g_MyInterface = (IMyInterface *)((g_Ismm->serverFactory())(INTERFACEVERSION_MYINTERFACE, NULL))
if (g_MyInterface == NULL)
{
META_CONPRINTF("WARNING! Could not find interface %s\n", INTERFACE_MINTERFACE);
}