You need to create a DLLMain
function which will be called when your DLL gets loaded or unloaded.
http://msdn.microsoft.com/en-gb/library/windows/desktop/ms682583(v=vs.85).aspx
BOOL WINAPI DllMain(HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
/* Init Code here */
break;
case DLL_THREAD_ATTACH:
/* Thread-specific init code here */
break;
case DLL_THREAD_DETACH:
/* Thread-specific cleanup code here.
*/
break;
case DLL_PROCESS_DETACH:
/* Cleanup code here */
break;
}
/* The return value is used for successful DLL_PROCESS_ATTACH */
return TRUE;
}
Now in here you'll need to call a function of your devising to register the fact that the DLL loaded (N.B. Make sure you look at what each switch case means above and initialise appropriately). it could do pretty much anything to be honest but maybe call a singleton and register (create an instance of your interface?) there.
Once you have that you should be able to do what you want. If you register both DLLs in the same way you will get the 2 way comms.
N.B. if you are providing an API it would probably be good if you have some initialisation call common to both DLLs so that the user sets up a "shared environment"