Open DefaultRyan opened 3 years ago
This is similar to what I called out on CsWin32: https://github.com/microsoft/CsWin32/issues/51
In particular, this is known to be problematic return types on C++ instance methods (like for COM/DirectX methods). There may of course be other scenarios, including future ones, that exist as well.
The current code is using the metadata struct HRESULT out of the box across the ABI. Unfortunately, unlike function params, structs are not handled the same way at the ABI as integers, so frame/register corruption is occurring.
For a short-term fix, replace the HRESULT struct with the integral value at the ABI.
Long-term, we'll need to figure out what the projected types vs ABI types look like. The type system for Win32 is far less constrained than the WinRT type system, and the lack of conventions and rules presents some additional challenges for just how much we can encapsulate projection logic.