Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Exellon

COM or C++ Classes?

This topic is 6053 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it really worth all the trouble of implementing IUnknown, class factories, DLL server code, and all that other COM stuff to make a clean component based engine? Or are C++ classes sufficient?

Share this post


Link to post
Share on other sites
Advertisement
From my limited experience, I''d say that you don''t need COM to have a component based engine. One drawback of COM is that it requires the objects to be registered in the registry before you can create them. That means that you can''t just run your unzipped distribution of .exe and .dlls; you have to register them first. On the other side, the way COM handles creation/deletion/reference counting is quite nice. You can design and implement your own equivalent of IUnknown that has additional information specific to your engine.

I use COM to handle driver/plugin interaction for one of my projects. An MFC driver handles the UI, sets up input and DX/GL renderer, and loads the ATL/MFC plugin. The plugin only does the logic-related stuff, leaving the common tasks to the driver.

In another project, I decided not to use COM but just have an interface (abstract) class for rendering and input and provide several implementations that for the time being are located in the program .exe.

COM is several orders more powerful than what I''m using it for. You should outline the structure of your engine, the level of interaction between its components, who is responsible for construction and cleanup, and so on. Then, decide whether you want COM or not based on how well your design fits the COM world, the advantages and overheads you get from COM, etc.

Hope this helps. Let me just repeat that I''m not an expert on COM at all.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!