How to declare and link to RoInitialize,RoUninitialize,RoGetActivationFactory and HSTRING Functions in Mingw Gcc

The import library for these functions is runtimeobject.lib (which the MSDN documentation fails to mention). It can be found in the Windows SDK for Windows 8.


The library you need to link against is windowsapp.lib (and only this lib, remove all others).

Windowsapp.lib is an "umbrella" lib that provides the exports for the UWP APIs. Linking to Windowsapp.lib will add to your app dependencies on dlls that are present on all Windows 10 device families.

https://msdn.microsoft.com/en-gb/windows/uwp/get-started/universal-application-platform-guide#writing-code

For delay loading, you will need to load api-ms-win-core-winrt-l1-1-0.dll. This is listed as a Windows 8.1 API set, however if you check the documentation for RoInitialize it says the minimum supported client is Windows 8. Assuming you use LoadLibrary and GetProcAddress, it shouldn't matter.
https://msdn.microsoft.com/en-us/library/windows/desktop/dn933214(v=vs.85).aspx

The actual DLL that the method is implemented in is combase.dll, but they use the new API DLLs as a level of indirection so that they are free to change or update these in the future.

For future reference, the API sets for Windows 10 (UWP) are listed on a separate page to the API sets for Windows 8 (and 8.1). The stub DLL (for delay loading) is the same. https://msdn.microsoft.com/library/windows/desktop/mt186421