Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-platform alternative to COM

I've been enamoured with component based programming (be it with COM, another system, or just using the paradigm in plain C++). It requires a bit of getting used to, if one is usually used to the "traditional" OOP model, but it's definetely worth it. It's made my code more maintainable and easier to extend.

The project I'm currently working on is using the paradigm, but no set system. However, I'd really like to find some sort of system I could use with the following requirements. Switching over from what I have now to a new system would take a bit of time, but I'd save a multiple of that time later.

The requirements:

  1. Cross-platform
  2. Fast
  3. Works well with C++
  4. Supports cross-process marshalling

Let me elaborate on those requirements:

Cross-Platform

Basically, I need it to work on Windows and Mac. Linux would be nice, but is not in any way essential. Also, it really needs to fulfil the other requirements for all platforms. There's a COM for Mac, which would be ideal but it doesn't support requirement 4. Additionally, it must support both GCC and MSVC.

Fast

This is where CORBA unfortunately loses, even though it fulfils the other three requirements. In-process method calls need to be as fast as possible (ideally, like COM), since some of the routines might also be called from an audio interrupt.

Works well with C++

... I guess this one is mostly obvious. I don't mind not using C++ classes to implement components, though that would definetely be helpful, and the alternative must still be easy to use, especially since eventually I intend to release an API for 3rd party extensions.

Supports cross-process marshalling

By that I mean at least being able to serialize the calls. If this is done via code generated from an IDL, that's perfectly fine with me, and I also don't mind implementing the cross-process communication itself.

COM would be great, but it doesn't meet requirement 1 fully. CORBA would be great too, but it doesn't meet requirement 2 (even with the fastest ORB out there). XPCOM might not meet requirement 2, and doesn't work with MSVC so doesn't meet requirement 1.

Any ideas what else is out there? My next step would be to roll my own using protobufs or something similar, but of course I'd like to avoid that.

Update

To elaborate - an audio interrupt in this context can be as low as 2-3ms. That time isn't even available in full to me, as other components need to process in that time, and my software is itself wrapping another piece of software that needs to process in that time. This is why both in-process and cross-process marshalling needs to be extremely fast.

like image 369
Chris Walton Avatar asked Jun 06 '09 23:06

Chris Walton


2 Answers

For maximum breadth, I'd just use web services. A service-oriented approach is very close to a component-oriented approach, as only the service contracts (interfaces) are exposed, and no details of the inner workings of the service need ever be known by the clients.

like image 80
John Saunders Avatar answered Nov 07 '22 04:11

John Saunders


ICE from ZeroC http://www.zeroc.com/ is another alternative.

For those CORBA old-timers, Michi Henning was one of the gurus of the day. He is now with ZeroC. It is an open-source, cross-platform, including all your targets (including Linux), system.

C++ is only one of the languages, and ICE's C++ bindings are significantly better than the CORBA C++ bindings are.

like image 35
sdg Avatar answered Nov 07 '22 03:11

sdg