If you find this article contains errors or problems rendering it unreadable (missing images or files, mangled code, improper text formatting, etc) please contact the editor so corrections can be made. Thank you for helping us improve this resource
For a quick test run ComTest\Debug\ComTest.exe (Run Install Components.bat first!)
To Uninstall the components run Uninstall.bat
This simple COM tutorial just creates to fictive "renders" as COM objects and shows how to select a between different components that support the same interface.
Disclaimer: This has nothing to do with a real render. It's only a COM test.
Important: COM interfaces cannot change, or you must create a completely new interface and still retain the old one. (Like DirectX) As long as you don't alter the interface you can change the code to your heart's content without requiring a recompile of the client that uses the component. If two apps use the same component it's only loaded once and unloaded when all are done using it via refcounting.
API hint: If you have different components for each API, don't expose it to the outside world. That way a user of, say, the DirectX8 render will only need the runtime and not the SDK. (+ that's the whole point of one interface and different implementations
Common pitfall: Don't forget to include a *.def file or exported functions can't be seen by COM.