Closed Fulgen301 closed 1 year ago
There is no material difference which is why it is safe to call CoInitializeEx
instead of RoInitialize
except for some very obscure use cases that most projects don't have to consider. You are also free to call whichever API you prefer for your needs. C++/WinRT itself never calls these functions. The init_apartment
and uninit_apartment
wrapper functions remain for compatibility only, are not generally recommended, and aren't needed unless you're doing something very specific with apartments in which case you might as well call CoInitializeEx
or RoInitialize
directly. For more information see:
https://kennykerrca.wordpress.com/2018/03/24/cppwinrt-hosting-the-windows-runtime/
init_apartment is still being used by the docs, samples and templates (even the new WASDK ones). Perhaps those should be updated if this function is no longer recommended.
Version
Commit 691f6f8c9d6cbdde5ba99363a26f0f8a8486dd13
Summary
https://github.com/microsoft/cppwinrt/commit/a2c65b43e030bc9dd49c88d1f5afcfc9e0dd5f86 replaced the call to
RoInitialize
withCoInitializeEx
. Nowadays, Windows 7 support has been dropped, but the call toCoInitializeEx
remains, and while there are some differences in apartment creation between the two functions, it might be worth doing it the 'proper', aka documented, way since compatibility is no longer an issue.Reproducible example
No response
Expected behavior
No response
Actual behavior
No response
Additional comments
No response