4 ms·
COM is a fantastic invention and implementation. Granted, it was pretty painful in C and somewhat in C++, but all the other languages (VB and C# mostly, but pl
by hota_mazi 6y ago
COM is a fantastic invention and implementation.
Granted, it was pretty painful in C and somewhat in C++, but all the other languages (VB and C# mostly, but plenty of others) really unlock the power of COM.
Nothing like that remotely exists on Linux or macOS.
- recursive 6y agoMy only experience with COM (that I know of) was trying to do MS Office automation from C# >10 years ago. I recall that it was very awkward, and somehow prone to memory leaks, and unclosed resources. To this day, I still don't really understand what COM is, or is supposed to be. But I still have a negative visceral reaction.
- Ididntdothis 6y agothere is a big difference between out of process COM (like Office Automation) and in process COM (like WinRT and UWP or DirectX). Out of process was always a little tricky and not implemented well. DCOM was even worse. In process COM works really well. Edit: I should add that C# isn’t the best language for COM because it doesn’t release objects when they go out of scope so you either have to release everything manually or wait for the GC to kick in which can cause memory problems. VB and C++ and even PHP are better that way.
- jfkebwjsbx 6y agoWhat is the point of "In process COM"? Is the same as any other library? I thought COM was meant to communicate between processes? Any enlightenment is appreciated...
- jdub 6y agoIt lets you use libraries written in numerous supported languages with a richer, more object oriented interface than a C ABI. You can use the same underlying interface to call out of process or distributed objects.
- snuxoll 6y agoCOM is primarily used in-process, it exposes an ABI that allows multiple languages to operate on a common object model within the same process. That's why you can import COM controls into a .Net application by referencing the DLL in your project and work with them as if they were native CLR objects - or Python, Ruby, Perl, etc. for that matter.
- Ididntdothis 6y agoCOM is Common Object Model. What you mean is OLE. In process COM calls are basically direct DLL calls and therefore very fast.
- pjmlp 6y agoThat was kind of sorted out with the COM improvements in .NET 4.0 and SafeHandles.
- Ididntdothis 6y agoCan you give more detail?
- mycall 6y agoIs these problems fixed with AOT C# (CoreRT)?
- rk06 6y agoUnlikely, as those problems are coming because of Garbage Collection which is a core part of language. C++/Rust don't have GC, so they don't have those problems
- asveikau 6y agoThe bit about memory leaks is probably a comment on the effectiveness of the .net GC more than anything else. COM objects are reference counted. When the .net runtime GCs a wrapped COM object it bumps the count down. My experience from years ago is that can take a long time or not happen at all. There is a manual call that releases the object, after which it is no longer usable from .net.
- magicalhippo 6y ago> To this day, I still don't really understand what COM is Maybe some excerpts from the documentation[1]: "COM specifies an object model and programming requirements that enable COM objects (also called COM components, or sometimes simply objects) to interact with other objects. These objects can be within a single process, in other processes, and can even be on remote computers. They can be written in different languages, and they may be structurally quite dissimilar, which is why COM is referred to as a binary standard; a standard that applies after a program has been translated to binary machine code." "The only language requirement for COM is that code is generated in a language that can create structures of pointers and, either explicitly or implicitly, call functions through pointers." "Besides specifying the basic binary object standard, COM defines certain basic interfaces that provide functions common to all COM-based technologies, and it provides a small number of functions that all components require." [1]: https://docs.microsoft.com/en-us/windows/win32/com/the-component-object-model https://docs.microsoft.com/en-us/windows/win32/com/the-compo...
- dralley 6y agoGObject is somewhat similar but it's nowhere close to first-class (being a Gtk specific tech)
- tonyedgecombe 6y agoNothing like that remotely exists on Linux or macOS. https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFPlugIns/Concepts/com.html https://developer.apple.com/library/archive/documentation/Co...
- hota_mazi 6y agoThere have been plenty of attempts to emulate what COM does. All operating systems have some sort of object model and sharing API's, but neither macOS nor Linux have anywhere near the thriving ecosystem and actual cooperation model between applications that Windows has.
- winter_blue 6y agoYea, this is so true. It would be amazing if some standard similar to COM could unify the Linux community.
- snuxoll 6y agoGObject gets us some of the way, but the ABI and bindings for other languages make it a royal pain in the ass to export types from anything but C rather than just consuming them. Rather unfortunate, because with GIR you could easily have a program written in a mix of Rust, C, Go, C++, Vala, etc. all playing nicely if they were all able to expose to the common object model.
- lukeh 6y agoThe COM support in CoreFoundation (such as it is) is... unusual. I have actually used it but it doesn't give you much from memory, beyond a way to locate plugins by UUID and the IUnknown ABI layout.
- winter_blue 6y agoCOM brings back a lot of fantastic old memories. When I was a kid, I used to make VB6 applications, and I'd be able to get custom widgets from the Internet, and import them into my VB6 project seamlessly. It was truly amazing, and mind-expanding. The JS/React/etc web ecosystem doesn't come anywhere close, in terms of the ease-of-use that VB6 had.