Re: [Mingw-w64-public] How to compile a module including dwrite.h with C compiler?

2020-05-04 Thread Nikolay Sivov

On 5/4/20 2:22 PM, Ruslan Garipov wrote:

Hello!

The IDWriteTextLayout[1] interface inherits from the
IDWriteTextFormat[2] one.  Both declare, for example,
GetFontCollection() members.  Therefore, IDWriteTextLayout exploits C++
function overloading, which isn't available in C.

And that's where I failed: I need to compile a C code module including
dwrite.h header using CC:

$ cc -x c dwrite.h -o /dev/null 2>&1 | fgrep GetFontCollection
dwrite.h:2006:15: error: duplicate member 'GetFontCollection'
 2006 | STDMETHOD(GetFontCollection)(THIS_

Of course, there are other "duplicated member functions" like
GetFontFamilyNameLength(), GetFontFamilyName(), etc.

How can I compile my C code?  Am I doomed to use ITypeInfo and IDispatch
for IDWriteTextLayout objects in C code?


You can't compile it as C it looks like, as is. For Wine this header is 
built from dwrite.idl (that does not exist in SDK),
and widl was made to handle such cases by renaming vtable field of 
overloaded method. Second part
of this quirk is that inline wrappers like 
IDWriteTextLayout_GetFontCollection() are only emitted for overloaded 
variants.


It gets worse in newer dwrite headers, when same interface is using 
overloaded variants in its own methods list.


I didn't get the part about ITypeInfo/IDispatch, how are do you plan to 
apply it for dwrite that doesn't use automation-capable objects?


Oh, by the way, revision 75bdd3 misses a parenthesis:

diff --git a/mingw-w64-headers/include/dwrite.h 
b/mingw-w64-headers/include/dwrite.h

index 9a0cc02d..943cd738 100644
--- a/mingw-w64-headers/include/dwrite.h
+++ b/mingw-w64-headers/include/dwrite.h
@@ -1430,7 +1430,7 @@ 
DECLARE_INTERFACE_(IDWriteLocalFontFileLoader,IDWriteFontFileLoader)

 STDMETHOD_(ULONG, Release)(THIS) PURE;

 /* IDWriteFontFileLoader methods */
-    STDMETHOD(CreateStreamFromKey(THIS_ const void 
*fontFileReferenceKey,UINT32 
fontFileReferenceKeySize,IDWriteFontFileStream **fileStream) PURE;
+    STDMETHOD(CreateStreamFromKey)(THIS_ const void 
*fontFileReferenceKey,UINT32 
fontFileReferenceKeySize,IDWriteFontFileStream **fileStream) PURE;

 #endif

 /* IDWriteLocalFontFileLoader methods */


Please send a patch for that.


___
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] How to compile a module including dwrite.h with C compiler?

2020-05-04 Thread Biswapriyo Nath
Can you provide the project link which you want to compile?

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


[Mingw-w64-public] How to compile a module including dwrite.h with C compiler?

2020-05-04 Thread Ruslan Garipov

Hello!

The IDWriteTextLayout[1] interface inherits from the
IDWriteTextFormat[2] one.  Both declare, for example,
GetFontCollection() members.  Therefore, IDWriteTextLayout exploits C++
function overloading, which isn't available in C.

And that's where I failed: I need to compile a C code module including
dwrite.h header using CC:

$ cc -x c dwrite.h -o /dev/null 2>&1 | fgrep GetFontCollection
dwrite.h:2006:15: error: duplicate member 'GetFontCollection'
 2006 | STDMETHOD(GetFontCollection)(THIS_

Of course, there are other "duplicated member functions" like
GetFontFamilyNameLength(), GetFontFamilyName(), etc.

How can I compile my C code?  Am I doomed to use ITypeInfo and IDispatch
for IDWriteTextLayout objects in C code?

Oh, by the way, revision 75bdd3 misses a parenthesis:

diff --git a/mingw-w64-headers/include/dwrite.h 
b/mingw-w64-headers/include/dwrite.h

index 9a0cc02d..943cd738 100644
--- a/mingw-w64-headers/include/dwrite.h
+++ b/mingw-w64-headers/include/dwrite.h
@@ -1430,7 +1430,7 @@ 
DECLARE_INTERFACE_(IDWriteLocalFontFileLoader,IDWriteFontFileLoader)

 STDMETHOD_(ULONG, Release)(THIS) PURE;

 /* IDWriteFontFileLoader methods */
-STDMETHOD(CreateStreamFromKey(THIS_ const void 
*fontFileReferenceKey,UINT32 
fontFileReferenceKeySize,IDWriteFontFileStream **fileStream) PURE;
+STDMETHOD(CreateStreamFromKey)(THIS_ const void 
*fontFileReferenceKey,UINT32 
fontFileReferenceKeySize,IDWriteFontFileStream **fileStream) PURE;

 #endif

 /* IDWriteLocalFontFileLoader methods */

[1] 
https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetextlayout
[2] 
https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nn-dwrite-idwritetextformat



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