4 ms·
One thing i'm not sure about WinRT and cannot figure out from the docs, AFAIK it is possible to "bit bang" (or "byte bang" if you will) a COM object by arrangin
by Crinus 7y ago
One thing i'm not sure about WinRT and cannot figure out from the docs, AFAIK it is possible to "bit bang" (or "byte bang" if you will) a COM object by arranging everything in memory using plain old C structs (or equivalent for other languages) from compilers that weren't COM aware. Is it possible to do the same with WinRT or it requires the language to be WinRT aware? F.e. could i get something like TCC and write some code that uses a WinRT object even though TCC has no idea about WinRT?
- pjmlp 7y agoNot really, as it is more elaborated. https://docs.microsoft.com/en-us/uwp/winrt-cref/winrt-type-system https://docs.microsoft.com/en-us/uwp/winrt-cref/winrt-type-s... The documentation is a bit lacking, as it appeared with WinRT, then we had UAP, and finally UWP. While it all boils down to the same, those marketing changes, did cause the documentation to keep changing. Alongside C++/CX, there was the low level "Windows Runtime C++ Template Library (WRL)", which was basically an evolution of ATL, with MDIL 2.0. https://docs.microsoft.com/en-us/cpp/cppcx/wrl/windows-runtime-cpp-template-library-wrl?view=vs-2015 https://docs.microsoft.com/en-us/cpp/cppcx/wrl/windows-runti... Eventually MIDL improved to 3.0, as the work on C++/WinRT progressed. https://docs.microsoft.com/en-us/uwp/midl-3/ https://docs.microsoft.com/en-us/uwp/midl-3/ https://channel9.msdn.com/Shows/ifdefWINDOWS/MIDL3-with-Larry-Osterman https://channel9.msdn.com/Shows/ifdefWINDOWS/MIDL3-with-Larr... Here are some technical documents and sessions related to WinRT. "The Windows Runtime" https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/The-Windows-Runtime https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Th... "Windows Runtime internals: understanding "Hello World"" https://channel9.msdn.com/events/Build/BUILD2011/PLAT-875T https://channel9.msdn.com/events/Build/BUILD2011/PLAT-875T The C++/WinRT talks from Kenny Kerr, related how they migrated from C++/CX language extensions to the C++17 compliant WinRT in chronological order. "CppCon 2017: Scott Jones & Kenny Kerr “C++/WinRT and the Future of C++ on Windows”" https://www.youtube.com/watch?v=7TdpWB_vRZM https://www.youtube.com/watch?v=7TdpWB_vRZM "Effective C++/WinRT for UWP and Win32" https://www.youtube.com/watch?v=nOFNc2uTmGs https://www.youtube.com/watch?v=nOFNc2uTmGs "Meet C++/WinRT 2.0: Faster and smarter in the open" https://www.youtube.com/watch?v=X41j_gzSwOY https://www.youtube.com/watch?v=X41j_gzSwOY Uff, hope this sheds some light on your questions and anyone else that wants to get a clearer picture of COM and its evolution into UWP.
- ak39 7y agoThis reply should go into HN hall of fame. Thank you very much!
- asveikau 7y ago> it is possible to "bit bang"... a COM object by arranging everything in memory using plain old C structs ... from compilers that weren't COM aware. Is it possible to do the same with WinRT or it requires the language to be WinRT aware? Yes, actually, you can do that. I had such code working. Basically declared the IInspectable VTable as a C struct and filled it with my own implementation. Then wrote an "activator" for the relevant classes the same way. [What COM used to call factories.] Did the same thing with a few VTables for MS-authored WinRT classes calling into them in the other direction. All this was tedious, I had complicated reasons for wanting to do this and I eventually switched to WRL when those reasons disappeared. Writing COM/WinRT from C++ with something like WRL is much nicer.