Our great sponsors
-
cppcomponents
Allows you to write binary components in C++11 that can be used across different compilers and standard libraries
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
I like many parts of COM, but I believe that example mostly demonstrates bad parts, with IDL, registrations, and over-engineered support libraries.
There's nothing wrong with exporting factory functions from DLLs. Microsoft does it all the time, APIs like Direct3D, DirectDraw and Media Foundation don't come with type libraries are they aren't registered anywhere.
Speaking about support libraries, I once made my own: https://github.com/Const-me/ComLightInterop/tree/master/ComL... Compare examples from that article with this one: https://github.com/Const-me/ComLightInterop/blob/master/Demo... That source file is the complete DLL which implements a minimalistic COM object.
A few years back, I wanted to see what you could do if you really used modern C++ with the COM principles. This is what I came up with:
https://github.com/jbandela/cppcomponents
* There is no code generation or IDL files
* Components implement IUnknown
* You can have Constructors and static functions for C++ classes.
* You can take std::vector, std::string, std::tuple as parameters and return them (even if you are using different compilers and standard libraries)
* Cross-platform
Related posts
- NH: Unity OSS Open Context Circle Menu in Your Secen View
- Nephalem's nightmare. Exploring errors in Diablo 3 server emulator code
- Show HN: See your currently playing Spotify song in the menu bar
- The software industry rapidly convergng on 3 languages: Go, Rust, and JavaScript
- The Rise and Fall of the LAN Party