locked
How to use Winrt API's in c for creating libraries?

    Question

  • I have an existing C libraries which uses Win32 API but it is not supported in windows 8 metro store apps.

    I tried calling WinRT API but failed so is there any way ican use WinRT apis in C.

    Tuesday, November 27, 2012 7:18 AM

Answers

  • What Win32 APIs are you using in the C library that are 'not supported 'for Windows Store apps?

    Generally speaking, you can use C libraries in Windows Store apps, but they can't import functions that trigger warnings from the WACK validation tool.

    The easiest and most efficient way to consume or author WinRT APIs is via C++/CX. You can use C++ and WRL for consuming WinRT APIs, and while you can technically author them as will with C++ and WRL it's a lot of manual work keeping the source and IDLs in sync. You can do all the WinRT ABI stuff manually without using C++/CX or WRL, and you can even do it all with namespace mangled C types but you'll have to do all the digging into .h and .idl files on your own. You can find some examples of this on the Internet: http://stackoverflow.com/questions/7436144/using-winrt-from-c

    The expected native development language for WinRT applications for the Windows Store is C++11.

    Wednesday, November 28, 2012 8:32 PM