4 ms·
...You've just discovered why interfaces like COM and Cocoa are a good idea, yes. Welcome to 1999. Join me in cursing the proliferation of POSIX and FFIs. JOIN
by phendrenad2 5y ago
...You've just discovered why interfaces like COM and Cocoa are a good idea, yes. Welcome to 1999. Join me in cursing the proliferation of POSIX and FFIs. JOIN ME.
- Koshkin 5y agoWin32 API is another example of something that has been pretty stable… But then, it is basically C. (Just like COM is basically C++.)
- phendrenad2 5y agoCOM was meant to be language-agnostic, so I don't see how it's basically C++...
- Koshkin 5y agoInterfaces are made to match the C++ vtable. Using them from C, for example, is somewhat of a hassle. (Not to say anything about IDL…)
- ntauthority 5y agoNot exactly. They use a different calling convention (for systems where 'this' pointers are normally passed in a special place) from usual C++ classes to match C-ish, and there's a few other restrictions for things (overloads, inheritance) that otherwise differ across C++ ABIs and wouldn't map well to other non-C++ languages. The C wrappers generated by MIDL are also fairly similar to raw C++, compare (where pUnk is an IUnk *): pUnk->Something(&bA); with... IUnk_Something(pUnk, &bA); which expands to something like this: pUnk->lpVtbl->Something(pUnk, &bA);
- flohofwoe 5y agoCOM can also be seen as a mapping of C++ APIs (with some extras like interface versioning) onto C APIs, mainly as workaround for C++'s missing ABI stability (so that C++ APIs can be exposed via DLLs in a (C++) compiler-agnostic way).
- pjmlp 5y agoWin32 API is frozen in Windows XP timeframe, no wonder it is stable, all major new APIs since Longhorn failure are based in COM.