diff tests/mini/callingconv1.d @ 526:642f6fa854e5

First step towards D abi compliance. Framepointer elimination is now disabled for functions using inline asm (with a hack from aKor).
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 19 Aug 2008 20:18:01 +0200
parents
children 4ac97ec7c18e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/mini/callingconv1.d	Tue Aug 19 20:18:01 2008 +0200
@@ -0,0 +1,31 @@
+module mini.callingconv1;
+
+extern(C) int printf(char*, ...);
+
+float foo(float a, float b)
+{
+    return a + b;
+}
+
+void main()
+{
+    float a = 1.5;
+    float b = 2.5;
+    float c;
+
+    asm
+    {
+        mov EAX, [a];
+        push EAX;
+        mov EAX, [b];
+        push EAX;
+        call foo;
+        fstp c;
+    }
+
+    printf("%f\n", c);
+    
+    assert(c == 4.0);
+    
+    printf("passed\n", c);
+}