Have you seen this one before? Do you know a workaround? (DMD v2.063.2, on OX X 10.9)

file.d:

    extern(C)
    {
        int x = 0;
        void setx();
        void printx();
    }

    void main()
    {
        setx(); // sets x = 42
        writeln(x); // prints x = 0
        printx(); // prints x = 42
        x = 7;
        printx(); // prints x = 42
    }



file.c:

    #include <stdio.h>

    extern int x;

    void setx()
    {
        x = 42;
    }

    void printx()
    {
        printf("%d\n", x);
    }

Output:

    0
    42
    42

Reply via email to