6

Both LLVM and GCC support Objective-C, and I like the language. Hence, I'd be interested in targeting WinRT native code using LLVM or GCC, probably using MinGW.

While the question I'm interested in should be easily googlable, I couldn't find any salient information: does either LLVM or GCC support targeting WinRT?


Intel has an article on using Intel C++ Compiler 13.0 with Visual Studio 2012 which may contain useful hints.

Also, a near duplicate question.

Community
  • 1
  • 1
Ivan Vučica
  • 9,529
  • 9
  • 60
  • 111
  • WinRT might be too recent for someone to have ported GCC or LLVM to it. If you know WinRT very well, you could try yourself (probably starting from some existing thing). Then please publish your patch under appropriate free software license. – Basile Starynkevitch Nov 09 '12 at 19:37
  • It's probably going to be impossible to do this without help from MS. WinRT is locked down. – David Heffernan Nov 09 '12 at 20:30
  • [The Intel page above](https://software.intel.com/en-us/articles/experimenting-with-intel-c-compiler-130-and-windows-8-store-apps) is merely discussing getting the Intel C/C++ compiler to cooperate in building a x86 app for Windows Store, such as for the x86-ISA-based set {Surface Pro, Surface Pro 2, desktops, laptops, …}. [The Intel page above](https://software.intel.com/en-us/articles/experimenting-with-intel-c-compiler-130-and-windows-8-store-apps) says nothing about Intel's compiler cross-compiling to the competitor's (i.e., ARM's) ISA. – Andreas ZUERCHER May 11 '14 at 12:16
  • I did not notice I mentioned ARM somewhere. Perhaps you are confused by the nomenclature: WinRT is the API, Windows RT is the OS. – Ivan Vučica May 11 '14 at 20:42

2 Answers2

2

Clang now has full support for native C and C++ on Windows, with the native ABI, etc. If there is a C or C++ API for WinRT, you should easily be able to call that with code compiled using Clang on Windows.

That doesn't directly connect ObjC to WinRT, but you could potentially write code to build such a connection if you wished.

Chandler Carruth
  • 3,011
  • 1
  • 18
  • 26
0

For the moment, you're stuck with MSVC. While it's not impossible to access the API itself (it's basically COM with some bells and whistles), it wouldn't be much fun to interface it with Objective-C without jumping through some hooks.

One problem I see initially would be the fact that Objective C doesn't support namespaces and using the WinRT API from within Objective C probably wouldn't be much fun. The PPL is available for C++ and in C# there's the await keyword but using all these ...Async methods in Objective-C... you probably don't want that ;)

Marcus Ilgner
  • 6,935
  • 2
  • 30
  • 44
  • Namespacing could, in theory, be emulated via having namespace implemented as a class (a 'namespace-class') which contains further namespace-classes as well as actual classes, etc. ;-) On the other hand, what I am interested is just being able to compile anything at all -- basically, just opening a Metro UI screen with a single button -- from C using MinGW. If I can use C from MinGW, I can write a wrapper for my game which uses Objective-C ;-) – Ivan Vučica Nov 14 '12 at 12:34
  • Also the compiler and linker would need to support .winmd files, so I don't think this is something you can expect anytime soon. – Marcus Ilgner Nov 14 '12 at 13:13
  • Looks like many .winmd files are plain old PE .dlls - http://www.codeproject.com/Articles/476957/WINMDplusFilesplusUnderplustheplusHood although sometimes they contain only class descriptions/references: http://mariusbancila.ro/blog/2011/10/30/winrt-and-winmd-files/ Perhaps we can avoid that by dynamically loading the .winmd and using COM to instantiate objects? – Ivan Vučica Nov 15 '12 at 13:58