How the host will load a Plug-In

The host application will handle a Plug-In in the following manner (some code is Windows-specific!):

HMODULE hModule = LoadLibrary ("SomePlugin.dll");
if (hModule)
{
        GetFactoryProc proc = (GetFactoryProc)GetProcAddress (hModule, "GetPluginFactory");

        IPluginFactory* factory = proc ? proc () : 0;
        if (factory)
        {
                for (int32 i = 0; i < factory->countClasses (); i++)
                {
                        PClassInfo ci;
                        factory->getClassInfo (i, &ci);

                        FUnknown* obj;
                        factory->createInstance (ci.cid, FUnknown::iid, (void**)&obj);
                        ...
                        obj->release ();
                }

                factory->release ();
        }

        FreeLibrary (hModule);
}
Empty

Copyright ©2008 Steinberg Media Technologies. All Rights Reserved.