= asm = ''Part of'' KeywordsCategory == Description == D allows the use of inline assembly language == Example == {{{ #!d void main() { int myint = 1234; char* mystring = "This number -> %d <- should be 1234\n"; asm { push dword ptr myint ; // pointer to the integer variable declared in D push dword ptr mystring ; // pointer into the C-style string declared in D call printf ; // call the printf function } /* This piece of code is the assembly equivalent of the C/D code int myint = 1234; printf("This number -> %d <- should be 1234\n", myint); */ } }}} == Expected Output == {{{ This number -> 1234 <- should be 1234 }}} == More Information == Inspired by a code snippet found at in the [http://home.comcast.net/%7Efbkotler/nasmdoc8.html#section-8.1.2 NASM manual]. For more details regarding asm blocks in D, check out the [http://www.digitalmars.com/d/iasm.html D Specification]. This example was tested on a x86 machine. I don't have any idea whether it'd work on any other platforms. == Source == || Link || http://www.dsource.org/tutorials/index.php?show_example=78 || || Posted by || jcc7 || || Date/Time || Thu Dec 2, 2004 6:48 pm ||