4 ms·
The main problem is it came about 20 years too late. Anybody writing libraries in C++ today either use C linkage or ship multiple versions.
by snarfy 4y ago
The main problem is it came about 20 years too late. Anybody writing libraries in C++ today either use C linkage or ship multiple versions.
- pjmlp 4y agoThird option, we use COM.
- zozbot234 4y agoCOM boils down to a C ABI, aiui.
- vnorilo 4y agoIIRC COM relies on vftables being ABI stable so you can pass interface pointers. As long as the interfaces don't pass any non-primitives by value. It is how I often provide APIs that need to work across (many) compiler boundaries. It is not standardized or anything, but de facto reliable on Windows.
- pjmlp 4y agoNot really, that is what people think, while forgetting that it comes along with a type system, has two models of method invocations. And with the introduction of WinRT extensions, it got even richers. Naturally one can try to call COM via C, and there are some COM APIs that offer C versions of them, however the tooling is already bad enough for .NET and C++ devs, doing it from C only for masochits or people that are religiouly against productive tooling.
- actionfromafar 4y agoI saw an assembler tutorial for coding against COM and it actually looked easier than in C. (There was no faffing about with types...) I wish I could find that blog or whatever it was again.
- pjmlp 4y agoWell, if you are fealing lucky that is a possibility as well, This book has a Windows game, with DirectX, written in Assembly, https://www.amazon.com/Programming-Tricks-Trade-Premier-Development/dp/1931841691 https://www.amazon.com/Programming-Tricks-Trade-Premier-Deve...