Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does MSVC not support inline assembly for AMD64 and Itanium targets?

Yesterday I learned that inline assembly (with the __asm keyword) is not supported under Microsoft Visual C++ when compiling for AMD64 and Itanium targets.

Is that correct? And if so, does anyone know why they would not support inline assembly for those targets? It seems like a rather big feature to just drop...

like image 761
Jeremy Friesner Avatar asked Aug 18 '09 17:08

Jeremy Friesner


2 Answers

Correct, it still isn't supported in VS 2010 Beta 1. My guess is that inline assembly is just too difficult to implement: the way Microsoft implemented it, it integrates with the surrounding C code so that data can flow in and out of the C code, and appropriate glue code is automatically injected. For that, the C compiler actually needs to understand the assembler code; they just haven't implemented that for AMD64 and Itanium.

like image 85
Martin v. Löwis Avatar answered Oct 19 '22 01:10

Martin v. Löwis


It seems like a rather big feature to just drop...

It's quite easy to call a function written with an assembler, as long as you follow C conventions. This tutorial explains how.

like image 43
Bastien Léonard Avatar answered Oct 18 '22 23:10

Bastien Léonard