On 10/13/20 3:40 PM, Pierre Lamot wrote: > Hello > > I'm trying to write a program that uses the DirectComposition API on > windows. While most of the API works correctly, some functions crash > when compiled with clang/gcc mingw64 and works when compiled with MSVC. > > basically the following code works with MSVC and crashes with > clang/gcc mingw64: > > IDCompositionTranslateTransform* translateTransform = nullptr; > hr = dcompDevice->CreateTranslateTransform(&translateTransform); > if (FAILED(hr) || !translateTransform) > throw > std::runtime_error("dcompDevice->CreateTranslateTransform"); > hr = translateTransform->SetOffsetX(42.f); //BOOM > if (FAILED(hr)) > throw std::runtime_error("translateVisual->SetOffsetX"); > > the translateTransform pointer seems correct, the call to SetOffsetX > crashes, it doesn't return. > > I enclosed the full sample for reference. > > As far as I can tell there is no real differences between the header > provided by MS and the one from Mingw. > > While I have no clear idea about the cause of the issue, my gut > feeling is that it happens with overloaded functions. In above case: > > STDMETHOD(SetOffsetX)(THIS_ float) PURE; > STDMETHOD(SetOffsetX)(THIS_ IDCompositionAnimation*) PURE;
That's right, overloads like that appear in reversed order in actual vtable. So method with float arg gets higher address. > > I did my tests with > * MSVC 19.25.28612 (x86-64 & i686) => works > * Mingw 7.0.x (ceb3ac2f42d56504fae5bd5cfe7f681643baccd6) with > * clang 10.0.0 (x86-64 & i686) => crash > * gcc 10.1.0 (x86-64) => crash > > Thanks for your input. > > Pierre > > _______________________________________________ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public