7

Can an Metro Windows 8 Application contain inline Assembler? Also is Metro C++ Native, or managed, or can you mix them both like C++/CLI?

LihO
  • 41,190
  • 11
  • 99
  • 167
klumsy
  • 4,081
  • 5
  • 32
  • 42
  • I don't see how it would be useful if you could. Are you going to write both x64 and ARM asm? – ildjarn Jun 15 '12 at 20:16
  • @ildjarn: Seems, that portability of his code is obviously not what he's looking for. – LihO Jun 15 '12 at 20:23
  • 1
    @ildjarn , just curious at this stage, but yes if i wanted to i'd have to , just like compiling binary to different targets, write conditional code for X64 and ARM. which isn't a big deal since in the past i wrote conditional Assembler for MMX, Amd 3dNow, SSE, SSE2, SSE3 etc all on the x86 platform. – klumsy Jun 15 '12 at 23:48

1 Answers1

9

Metro style apps use WinRT, which is COM-based replacement of an old WinAPI. You are able to create own WinRT components that can be used from .NET or even from JavaScript - and it costs you no extra effort. As for existing C++ code, note that only a subset of Win32 is provided in WinRT.

enter image description here

It doesn't matter whether you code in C/C++, C# or JS, when you use WinRT, you don't directly call the WinRT but it goes through a binding called projection, which is what takes care of your WinRT components to be exposed to the other language appropriately.

enter image description here

"Can an Metro Windows 8 Application contain inline Assembler?"
You are able to embed assembly-language instructions directly in your C and C++ code because your compiler allows you to do that. Look at Inline Assembler as a set of assembly instructions written as inline functions, that are built in the compiler. The fact that you are using WinRT is irrelevant here.

Questions, that could help you:
Why is WinRT unmanaged?
C++, C# and JavaScript on WinRT
What are WinRT language projections?

Community
  • 1
  • 1
LihO
  • 41,190
  • 11
  • 99
  • 167
  • thanks. I know the APIs you can access from C++ are limited, i'm just wondering if you can do inline Assembler.. Like a simple ASM algoritm, that is self contained and doesn't call any APIS? – klumsy Jun 15 '12 at 19:49
  • @klumsy: You are able to write Inline Assembler in your C and C++ code as long as your **compiler** allows you to do that. Check my answer now. – LihO Jun 15 '12 at 20:10
  • I don't know if it will pass WACK, however. – JP Alioto Jun 16 '12 at 01:19
  • The WACK is a binary level static analysis tool. It doesn't analyze source. – John Lam Jun 26 '12 at 07:05