[Issue 15015] New: Win64: interop with C/C++ fails if function return value is a struct of size 8

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Sep 5 01:40:31 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=15015

          Issue ID: 15015
           Summary: Win64: interop with C/C++ fails if function return
                    value is a struct of size 8
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: r.sagitario at gmx.de

Currently versioned out in the dmd test suite:

// from cabi1.d
struct Foo5 { int i, j; }

extern (C) Foo5 ctest5();

void main()
{
    Foo5 f5 = ctest5();
    assert(f5.i == 0x12345678);
    assert(f5.j == 0x21436587);
}

// from cabi2.cpp
struct Foo5 { int i, j; };

struct Foo5 ctest5()
{
    struct Foo5 f;

    f.i = 0x12345678;
    f.j = 0x21436587;
    return f;
}

///
compile with x64 cl:
cl /c cabi2.cpp
dmd -m64 cabi1.cpp cabi2.obj
./cabi1

raises assertion failure.

--


More information about the Digitalmars-d-bugs mailing list