view tests/mini/callingconv1.d @ 650:aa6a0b7968f7

Added test case for bug #100 Removed dubious check for not emitting static private global in other modules without access. This should be handled properly somewhere else, it's causing unresolved global errors for stuff that should work (in MiniD)
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sun, 05 Oct 2008 17:28:15 +0200
parents 642f6fa854e5
children 4ac97ec7c18e
line wrap: on
line source

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);
}