[Issue 16987] New: ABI error wrt. COM interfaces returning structs
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Dec 19 15:07:14 PST 2016
https://issues.dlang.org/show_bug.cgi?id=16987
Issue ID: 16987
Summary: ABI error wrt. COM interfaces returning structs
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: kinke at gmx.net
>From http://forum.dlang.org/post/tiyttpodenppvlfxixcw@forum.dlang.org, relevant
wrt. interfacing with DirectX libraries:
COM classes/interfaces are apparently subject to a separate ABI. Unfortunately,
googling it hasn't turned up any official (and not even some inofficial)
documentation so far. Based on the first few tests on Win64, integers are
returned in RAX, floats (and I guess doubles too) in XMM0, and structs (incl.
2x int32 and 2x float) via hidden sret pointer, with `this` pointer in RCX (1st
arg) and `sret` in RDX (2nd arg). Compared to the normal Win64 C++ ABI it just
seems more conservative by always returning structs via hidden pointer.
While at it, please also fix https://issues.dlang.org/show_bug.cgi?id=16527 by
simply swapping the order of `this` and `sret` pointer arguments on Windows
(32-bit: extern(C++) methods only, 64-bit: always; LDC already does so).
--
More information about the Digitalmars-d-bugs
mailing list