Skip to content
Modern (idiomatic) binding between COM and C++
C++ CMake Other
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead of alamaison:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Comet: a modern C++ language binding for COM


IMPORTANT: You do not have to build this library before using it. It is a header-only library. Many modern C++ libraries are developed this way and it makes them much easier to reuse - something we really want to encourage.

What is Comet?

Comet is a library that provides a modern (STL-like) C++ interface around the complexities of Microsoft COM. It allows you to do both COM client and COM server programming, without any dependency on either ATL or MFC. Instead, it builds upon the C++ Standard Library that is included with every modern C++ compiler, regardless of platform.

I have seen other versions of comet. What version is this?

Other versions of Comet are most likely version 1 gamma 32 plus or minus a few bugfixes. This is Comet version 2 because it breaks backward compatibility with those versions so that we can develop it more freely.

Comet was designed and implemented by Sofus Mortensen with contributions, ideas and bug fixes from Paul Hollingsworth, Michael Geddes, Mikael Lindgren, Kyle Alons and Vladimir Voinkov. This version of comet is maintained by Alexander Lamaison.

How do I use comet?

Just add comet/include to your compiler's include path and you are ready to go.


If you're using CMake version 3 or above for your project, Comet can set itself up for you. Remember you don't have to compile Comet. The CMake files just make it easier to use in an existing CMake project.

find_package(Comet REQUIRED CONFIG)
target_link_libraries(my_project_target PRIVATE comet)

Because Comet is header-only, this doesn't link in the traditional sense. It just makes the target aware of Comet's usage requirements such as the include path. Referencing Comet this way means you don't have to change your build configuration if those requirements change in the future.

Of course, you have to make Comet available to your project. There are two ways to do this:


If you have a CMake 'superbuild' to pull in dependencies automatically, you can add Comet like this:


    URL_HASH SHA1=dced97055d9ce593ffa52b0ba067ac04b0d96239

    MyProject DEPENDS Comet

When you build your super-project, CMake will download Comet, and export its configuration to the user package registry where your project will find it by calling find_package.


Download and configure Comet.

$ cmake -H . -B _builds -DBUILD_TESTING=NO

This will export it to the user package registry where your project will find it by calling find_package.

What about a reference? Or tutorials?

The library is documented inline and you can use Doxygen to generate documentation for it if you want. Also, read the following articles. They are based on Comet v1 but, as yet, there isn't much difference.

And last but not least, the Comet version 1 documentation.

Are there any dependencies?

No, not really. We use Boost, but only for the test suite so you don't even need that.


Copyright © 2000-2014 Sofus Mortensen and others

This material is provided "as is", with absolutely no warranty expressed or implied. Any use is at your own risk. Permission to use or copy this software for any purpose is hereby granted without fee, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice.

You can’t perform that action at this time.