Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-16 Thread Nikolay Sivov



On 1/16/22 15:26, Luca Bacci wrote:

Probably many of you already know about that blog post by Raymond Chen, but
I'll post a link here anyway because it's relevant to this discussion:

https://devblogs.microsoft.com/oldnewthing/20220113-00/?p=106152


I never heard of it. I tested just now with midl 8.01.0626, and it does 
work,
placing explicit RetVal argument, shipped d3d12.h header uses same 
structure now.


We could probably adopt this option and output formatting for widl too.

Now let's wait for one more C-compat switch that will deal with 
overloaded methods in DirectWrite headers, making it usable in C.


Il dom 16 gen 2022, 11:52 Vincent Torri  ha
scritto:


On Sun, Jan 16, 2022 at 10:44 AM Martin Mitáš  wrote:


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.

It is for a toolkit that is not portable to msvc anyway. So I care
only about mingw-w64


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

hoo, you're the author of md4c :-) I use it for this toolkit :-)

I'll look at it.


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).

not a problem. Only a few functions have problems. Technically
speaking, I can even replace them by something else (GetPixelSize -->
size of the client region of the Windows, and GetPixelFormat, well, I
use only one pixel format,  so not a problem). Your license is also
good.


(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.

i did something similar to have a dcomp C API for some functions.


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

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




___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-16 Thread Luca Bacci
Probably many of you already know about that blog post by Raymond Chen, but
I'll post a link here anyway because it's relevant to this discussion:

https://devblogs.microsoft.com/oldnewthing/20220113-00/?p=106152

Il dom 16 gen 2022, 11:52 Vincent Torri  ha
scritto:

> On Sun, Jan 16, 2022 at 10:44 AM Martin Mitáš  wrote:
> >
> >
> > 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.
>
> It is for a toolkit that is not portable to msvc anyway. So I care
> only about mingw-w64
>
> > 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
>
> hoo, you're the author of md4c :-) I use it for this toolkit :-)
>
> I'll look at it.
>
> > 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).
>
> not a problem. Only a few functions have problems. Technically
> speaking, I can even replace them by something else (GetPixelSize -->
> size of the client region of the Windows, and GetPixelFormat, well, I
> use only one pixel format,  so not a problem). Your license is also
> good.
>
> > (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.
>
> i did something similar to have a dcomp C API for some functions.
>
> > So whether this is the right path forward for you, I don't know. Depends
> > on your trade-off considerations and requirements.
>
> 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


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-16 Thread Vincent Torri
On Sun, Jan 16, 2022 at 10:44 AM Martin Mitáš  wrote:
>
>
> 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.

It is for a toolkit that is not portable to msvc anyway. So I care
only about mingw-w64

> 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

hoo, you're the author of md4c :-) I use it for this toolkit :-)

I'll look at it.

> 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).

not a problem. Only a few functions have problems. Technically
speaking, I can even replace them by something else (GetPixelSize -->
size of the client region of the Windows, and GetPixelFormat, well, I
use only one pixel format,  so not a problem). Your license is also
good.

> (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.

i did something similar to have a dcomp C API for some functions.

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

thank you

Vincent Torri


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-16 Thread Vincent Torri
On Sun, Jan 16, 2022 at 10:18 AM Nikolay Sivov  wrote:
>
>
>
> On 1/16/22 10:06, Vincent Torri wrote:
> > hello
> >
> > On Sat, Jan 15, 2022 at 9:28 AM Vincent Torri  
> > wrote:
> >> On Sat, Jan 15, 2022 at 7:43 AM Nikolay Sivov  
> >> wrote:
> >>>
> >>>
> >>> On 1/14/22 23:05, Vincent Torri wrote:
>  On Fri, Jan 14, 2022 at 6:31 PM Nikolay Sivov  
>  wrote:
> >> 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
> > It's a known thing, C-compatible prototypes would be different for such
> > methods:
> >
> > D2D1_SIZE_U * ID3D1HwndRenderTarget_GetPixelSize(void *this, D2D1_SIZE_U
> > *size).
>  but then I have a compilation error because in d2d1.h provided by
>  mingw-w64, GetPixelSize() has only 1 argument, not 2.
> >>> Naturally, because headers are not prepared for that.
> >>>
> >>> If you wanted to use C++ with msvc compatible prototypes, there is
> >>> WIDL_EXPLICIT_AGGREGATE_RETURNS for that,
> >>> for C definitions it won't work, you'll have to use wine headers, or
> >>> more specifically a header widl produces from wine's d2d1.idl. Widl
> >>> detects such cases automatically, see is_aggregate_return() in widl 
> >>> sources.
> >>>
> >>> I think what should be done is WIDL_EXPLICIT_AGGREGATE_RETURNS case for
> >>> C definitions patched in for mingw headers.
> > i've installed wine in archlinux, and
> > ID3D1HwndRenderTarget_GetPixelSize is defined with another macro, i
> > guess, which i don't know the value (no lucj with an fgrep -r in
> > /usr/include/wine
> >
> > so i don't know the declaration of the function with d2d1.h provided with 
> > wine
>
> Please take a closer look, there is a function wrapper called
> ID2D1HwndRenderTarget_GetPixelSize().

yes, and it has 1 argument, the render target (in the archlinux installed wine)

> Also see attached patch, maybe that's enough to make it work for now.

I'll try it, thank you

Vincent Torri


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-16 Thread Martin Mitáš


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


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-16 Thread Nikolay Sivov



On 1/16/22 10:06, Vincent Torri wrote:

hello

On Sat, Jan 15, 2022 at 9:28 AM Vincent Torri  wrote:

On Sat, Jan 15, 2022 at 7:43 AM Nikolay Sivov  wrote:



On 1/14/22 23:05, Vincent Torri wrote:

On Fri, Jan 14, 2022 at 6:31 PM Nikolay Sivov  wrote:

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

It's a known thing, C-compatible prototypes would be different for such
methods:

D2D1_SIZE_U * ID3D1HwndRenderTarget_GetPixelSize(void *this, D2D1_SIZE_U
*size).

but then I have a compilation error because in d2d1.h provided by
mingw-w64, GetPixelSize() has only 1 argument, not 2.

Naturally, because headers are not prepared for that.

If you wanted to use C++ with msvc compatible prototypes, there is
WIDL_EXPLICIT_AGGREGATE_RETURNS for that,
for C definitions it won't work, you'll have to use wine headers, or
more specifically a header widl produces from wine's d2d1.idl. Widl
detects such cases automatically, see is_aggregate_return() in widl sources.

I think what should be done is WIDL_EXPLICIT_AGGREGATE_RETURNS case for
C definitions patched in for mingw headers.

i've installed wine in archlinux, and
ID3D1HwndRenderTarget_GetPixelSize is defined with another macro, i
guess, which i don't know the value (no lucj with an fgrep -r in
/usr/include/wine

so i don't know the declaration of the function with d2d1.h provided with wine


Please take a closer look, there is a function wrapper called 
ID2D1HwndRenderTarget_GetPixelSize().


Also see attached patch, maybe that's enough to make it work for now.



Vincent Torri
From 88508f6dd75b80ce7e4fc40053f568449447476b Mon Sep 17 00:00:00 2001
From: Nikolay Sivov 
Date: Sun, 16 Jan 2022 12:13:25 +0300
Subject: [PATCH] d2d1: Fixup C method prototypes that are using aggregate
 return values.

Signed-off-by: Nikolay Sivov 
---
 mingw-w64-headers/include/d2d1.h | 48 
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/mingw-w64-headers/include/d2d1.h b/mingw-w64-headers/include/d2d1.h
index 66f3ee4dc..3c5c570df 100644
--- a/mingw-w64-headers/include/d2d1.h
+++ b/mingw-w64-headers/include/d2d1.h
@@ -613,9 +613,9 @@ interface ID2D1Bitmap : public ID2D1Image {
 typedef struct ID2D1BitmapVtbl {
 ID2D1ImageVtbl Base;
 
-STDMETHOD_(D2D1_SIZE_F, GetSize)(ID2D1Bitmap *This) PURE;
-STDMETHOD_(D2D1_SIZE_U, GetPixelSize)(ID2D1Bitmap *This) PURE;
-STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)(ID2D1Bitmap *This) PURE;
+STDMETHOD_(D2D1_SIZE_F*, GetSize)(ID2D1Bitmap *This, D2D1_SIZE_T *__ret) 
PURE;
+STDMETHOD_(D2D1_SIZE_U*, GetPixelSize)(ID2D1Bitmap *This, D2D1_SIZE_U 
*__ret) PURE;
+STDMETHOD_(D2D1_PIXEL_FORMAT*, GetPixelFormat)(ID2D1Bitmap *This, 
D2D1_PIXEL_FORMAT *__ret) PURE;
 STDMETHOD_(void, GetDpi)(ID2D1Bitmap *This, FLOAT *dpiX, FLOAT *dpiY) PURE;
 STDMETHOD(CopyFromBitmap)(ID2D1Bitmap *This, const D2D1_POINT_2U 
*destPoint, ID2D1Bitmap *bitmap, const D2D1_RECT_U *srcRect) PURE;
 STDMETHOD(CopyFromRenderTarget)(ID2D1Bitmap *This, const D2D1_POINT_2U 
*destPoint, ID2D1RenderTarget *renderTarget, const D2D1_RECT_U *srcRect) PURE;
@@ -630,9 +630,9 @@ interface ID2D1Bitmap {
 #define ID2D1Bitmap_AddRef(this) 
(this)->lpVtbl->Base.Base.Base.AddRef((IUnknown*)(this))
 #define ID2D1Bitmap_Release(this) 
(this)->lpVtbl->Base.Base.Base.Release((IUnknown*)(this))
 #define ID2D1Bitmap_GetFactory(this,A) 
(this)->lpVtbl->Base.Base.GetFactory((ID2D1Resource*)(this),A)
-#define ID2D1Bitmap_GetSize(this) (this)->lpVtbl->GetSize(this)
-#define ID2D1Bitmap_GetPixelSize(this) (this)->lpVtbl->GetPixelSize(this)
-#define ID2D1Bitmap_GetPixelFormat(this) (this)->lpVtbl->GetPixelFormat(this)
+#define ID2D1Bitmap_GetSize(this,A) (this)->lpVtbl->GetSize(this,A)
+#define ID2D1Bitmap_GetPixelSize(this,A) (this)->lpVtbl->GetPixelSize(this,A)
+#define ID2D1Bitmap_GetPixelFormat(this,A) 
(this)->lpVtbl->GetPixelFormat(this,A)
 #define ID2D1Bitmap_GetDpi(this,A,B) (this)->lpVtbl->GetDpi(this,A,B)
 #define ID2D1Bitmap_CopyFromBitmap(this,A,B,C) 
(this)->lpVtbl->CopyFromBitmap(this,A,B,C)
 #define ID2D1Bitmap_CopyFromRenderTarget(this,A,B,C) 
(this)->lpVtbl->CopyFromRenderTarget(this,A,B,C)
@@ -980,11 +980,11 @@ typedef struct ID2D1RenderTargetVtbl {
 STDMETHOD_(void, Clear)(ID2D1RenderTarget *This, const D2D1_COLOR_F 
*clearColor) PURE;
 STDMETHOD_(void, BeginDraw)(ID2D1RenderTarget *This) PURE;
 STDMETHOD(EndDraw)(ID2D1RenderTarget *This, D2D1_TAG *tag1, D2D1_TAG 
*tag2) PURE;
-STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)(ID2D1RenderTarget *This) 
PURE;
+STDMETHOD_(D2D1_PIXEL_FORMAT*, GetPixelFormat)(ID2D1RenderTarget *This, 
D2D1_PIXEL_FORMAT *__ret) PURE;
 STDMETHOD_(void, SetDpi)(ID2D1RenderTarget *This, FLOAT dpiX, FLOAT dpiY) 
PURE;
 STDMETHOD_(void, GetDpi)(ID2D1RenderTarget *This, FLOAT *dpiX, FLOAT 
*dpiY) PURE;
-

Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-15 Thread Vincent Torri
hello

On Sat, Jan 15, 2022 at 9:28 AM Vincent Torri  wrote:
>
> On Sat, Jan 15, 2022 at 7:43 AM Nikolay Sivov  wrote:
> >
> >
> >
> > On 1/14/22 23:05, Vincent Torri wrote:
> > > On Fri, Jan 14, 2022 at 6:31 PM Nikolay Sivov  
> > > wrote:
> > >>> 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
> > >> It's a known thing, C-compatible prototypes would be different for such
> > >> methods:
> > >>
> > >> D2D1_SIZE_U * ID3D1HwndRenderTarget_GetPixelSize(void *this, D2D1_SIZE_U
> > >> *size).
> > > but then I have a compilation error because in d2d1.h provided by
> > > mingw-w64, GetPixelSize() has only 1 argument, not 2.
> >
> > Naturally, because headers are not prepared for that.
> >
> > If you wanted to use C++ with msvc compatible prototypes, there is
> > WIDL_EXPLICIT_AGGREGATE_RETURNS for that,
> > for C definitions it won't work, you'll have to use wine headers, or
> > more specifically a header widl produces from wine's d2d1.idl. Widl
> > detects such cases automatically, see is_aggregate_return() in widl sources.
> >
> > I think what should be done is WIDL_EXPLICIT_AGGREGATE_RETURNS case for
> > C definitions patched in for mingw headers.

i've installed wine in archlinux, and
ID3D1HwndRenderTarget_GetPixelSize is defined with another macro, i
guess, which i don't know the value (no lucj with an fgrep -r in
/usr/include/wine

so i don't know the declaration of the function with d2d1.h provided with wine

Vincent Torri


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-15 Thread Vincent Torri
On Sat, Jan 15, 2022 at 7:43 AM Nikolay Sivov  wrote:
>
>
>
> On 1/14/22 23:05, Vincent Torri wrote:
> > On Fri, Jan 14, 2022 at 6:31 PM Nikolay Sivov  
> > wrote:
> >>> 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
> >> It's a known thing, C-compatible prototypes would be different for such
> >> methods:
> >>
> >> D2D1_SIZE_U * ID3D1HwndRenderTarget_GetPixelSize(void *this, D2D1_SIZE_U
> >> *size).
> > but then I have a compilation error because in d2d1.h provided by
> > mingw-w64, GetPixelSize() has only 1 argument, not 2.
>
> Naturally, because headers are not prepared for that.
>
> If you wanted to use C++ with msvc compatible prototypes, there is
> WIDL_EXPLICIT_AGGREGATE_RETURNS for that,
> for C definitions it won't work, you'll have to use wine headers, or
> more specifically a header widl produces from wine's d2d1.idl. Widl
> detects such cases automatically, see is_aggregate_return() in widl sources.
>
> I think what should be done is WIDL_EXPLICIT_AGGREGATE_RETURNS case for
> C definitions patched in for mingw headers.

who is the maintainer of these headers ? Jacek ? Martin ?

for now, what i can do is just having my own declarations in my source
code, based on wine generated headers

thank you

Vincent Torri


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-14 Thread Nikolay Sivov




On 1/14/22 23:05, Vincent Torri wrote:

On Fri, Jan 14, 2022 at 6:31 PM Nikolay Sivov  wrote:

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

It's a known thing, C-compatible prototypes would be different for such
methods:

D2D1_SIZE_U * ID3D1HwndRenderTarget_GetPixelSize(void *this, D2D1_SIZE_U
*size).

but then I have a compilation error because in d2d1.h provided by
mingw-w64, GetPixelSize() has only 1 argument, not 2.


Naturally, because headers are not prepared for that.

If you wanted to use C++ with msvc compatible prototypes, there is 
WIDL_EXPLICIT_AGGREGATE_RETURNS for that,
for C definitions it won't work, you'll have to use wine headers, or 
more specifically a header widl produces from wine's d2d1.idl. Widl 
detects such cases automatically, see is_aggregate_return() in widl sources.


I think what should be done is WIDL_EXPLICIT_AGGREGATE_RETURNS case for 
C definitions patched in for mingw headers.





You could check hows it's done in Wine, where we don't use C++.

do you have a link, please ?


We don't have generated headers checked in in the tree, so you'll have 
to get complete source tree, and build it, then see what generated 
headers look like.




thank you

Vincent




___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-14 Thread Vincent Torri
On Fri, Jan 14, 2022 at 6:31 PM Nikolay Sivov  wrote:
> >
> > 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
>
> It's a known thing, C-compatible prototypes would be different for such
> methods:
>
> D2D1_SIZE_U * ID3D1HwndRenderTarget_GetPixelSize(void *this, D2D1_SIZE_U
> *size).

but then I have a compilation error because in d2d1.h provided by
mingw-w64, GetPixelSize() has only 1 argument, not 2.

> You could check hows it's done in Wine, where we don't use C++.

do you have a link, please ?

thank you

Vincent


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-14 Thread Nikolay Sivov




On 1/14/22 20:16, Vincent Torri wrote:

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


It's a known thing, C-compatible prototypes would be different for such 
methods:


D2D1_SIZE_U * ID3D1HwndRenderTarget_GetPixelSize(void *this, D2D1_SIZE_U 
*size).


You could check hows it's done in Wine, where we don't use C++.



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


[Mingw-w64-public] direct2d functions work with C++ API, but not with C API

2022-01-14 Thread Vincent Torri
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