On Sat, Nov 23, 2019 at 9:27 PM Arthur Girardi <ad...@underdark.com.br>
wrote:

> Em sáb., 23 de nov. de 2019 às 14:27, Nikolay Sivov <bungleh...@gmail.com>
> escreveu:
>
> > On Sat, Nov 23, 2019 at 8:12 PM Arthur Girardi <ad...@underdark.com.br>
> > wrote:
> >
> > > > > I'm building the WIC Viewer using Direct2D[1] sample from
> Microsoft,
> > > > > converted to C, and I'm getting some strange SIGSERV at the
> function
> > > > > ID2D1HwndRenderTarget_GetSize(m_pRT) when the program is compiled
> > with
> > > > gcc
> > > > > 9.x on a x86_64 system. No problem occurs when compiled with any
> gcc
> > > 8.x
> > > > > x86_64 or gcc 9.x i686. All builds using MSYS2 toolchain packages.
> > > > >
> > > >
> > > > Please provide the exact commands that you used to invoke G++. I
> > > > compiled the sample program with the following commands and ran it
> but
> > > > observed no segmentation faults:
> > > >
> > > > ```
> > > > windres WicViewerD2D.rc -o WicViewerD2D.o
> > > > g++ -municode -mwindows *.cpp *.o  \
> > > >     -ld2d1 -lwindowscodecs -lole32  \
> > > >     -o WicViewerD2D.exe
> > > > ```
> > > >
> > >
> > > Below is the complete command used by the IDE. Please allow me to
> remind
> > > you that this program is a direct conversion to C from the sample, so
> no
> > > g++ is used.
> > >
> > > gcc.exe -c WicViewerD2D.c -o WicViewerD2D.o
> -I"C:/msys64/mingw64/include"
> > > -I"C:/msys64/mingw64/x86_64-w64-mingw32/include"
> > > -I"C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.2.0/include"
> > > windres.exe -i WicViewer_private.rc --input-format=rc -o
> > > WicViewer_private.res -O coff
> > > gcc.exe WicViewerD2D.o WicViewer_private.res -o WicViewer.exe
> > > -L"C:/msys64/mingw64/lib" -L"C:/msys64/mingw64/x86_64-w64-mingw32/lib"
> > > -static-libgcc -mwindows -lole32 -ld2d1
> > >
> >
> > Could you post your converted source somewhere? It could be an issue with
> > particular method prototype,
> > for example for GetSize() correct C prototype would be:
> >
> > D2D1_SIZE_F * target_GetSize(ID2D1HwndRenderTarget *iface, D2D1_SIZE_F
> > *size)
> >
>
> I've uploaded complete buildable source here[1]. It also includes a
> temporary fix at line 215 of WicViewerD2D.c that you need to remove to see
> the problem.
>

Thanks, I think mingw headers are broken when in C mode. Like I said, vtbl
method prototype should be:

     D2D1_SIZE_F * (STDMETHODCALLTYPE *GetSize)(
         ID2D1HwndRenderTarget *This,
         D2D1_SIZE_F *__ret);

In Wine we generate it from .idl sources, fixed up inline wrapper is like
this:

static FORCEINLINE D2D1_SIZE_F
ID2D1HwndRenderTarget_GetSize(ID2D1HwndRenderTarget* This) {
     D2D1_SIZE_F __ret;
     return *This->lpVtbl->GetSize(This,&__ret);
}



>
> [1] https://github.com/udbr/WicViewerD2D-C
>
> _______________________________________________
> 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

Reply via email to