Hello.

I was dealing with this exact problem some time ago.

Note the problem is wider. At certain point in time, Microsoft stopped to
care about C compatibility of (some of) their SDK headers. This includes 
GDI+ and Direct2D APIs for example.

I.e. even if you somehow make it work with mingw-w64 headers, it would still
not be buildable with MSVC. If you need that, your options are even more
limited and Wine headers won't help you much as I think their headers are
not compatible with Microsoft SDK.

For my projects, I've eventually ended with creating C-compatible headers
for D2D and GDI+. You can find them here:

https://github.com/mity/c-win32

However note they are not a drop-in replacement for two reasons:

(1) They are designed to live alongside standard SDK headers: The cost of
this decision is that all their top-level identifiers differ ("c_" prefix).

(2) They provide only stuff I needed so they're incomplete in many ways.
That said however adding more stuff should be quite a straight-forward
exercise.

So whether this is the right path forward for you, I don't know. Depends
on your trade-off considerations and requirements.

Regards,
Martin



Dne 14. 1. 2022 v 18:16 Vincent Torri napsal(a):
> Hello
> 
> first, I'm on Win10
> 
> After initializing Direct2D, when I call
> 
> ID2D1HwndRenderTarget_GetPixelSize
> 
>  with a HwndRenderTarget, i get a seg fault.
> 
> But when I use the C++ API, no problem.
> 
> there is the same behavior with GetPixelFormat()
> 
> on the contrary, CreateBitmap(), DrawBitmap(), BeginDraw(), EndDraw()
> or SetTransform() are working with the C API.
> 
> Does someone have an idea of the problem. I have a test program if you want
> 
> thank you
> 
> Vincent Torri
> 
> 
> _______________________________________________
> 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