• 02/02/01 09:41 AM
    Sign in to follow this  

    A Simple COM Tutorial

    General and Gameplay Programming

    Myopic Rhino
    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.

    If you have questions mail [email="com_me@nukesoftware.com"]com_me@nukesoftware.com[/email]

    Have fun and make component based systems :)

    Odin Jensen
    Lead Programmer
    Nuke Software


      Report Article
    Sign in to follow this  


    User Feedback

    Create an account or sign in to leave a review

    You need to be a member in order to leave a review

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    There are no reviews to display.