Dne 19. 12. 2014 v 10:20 Jack Andrews napsal(a):
> Thank you for mingw-w64.
> 
> I am writing a DLL extension in C (not C++) and I came across a problem when 
> I write test.c as:
> 
>  $cat test.c
>  #include <dwrite.h>
> 
> compiling the above causes an error.
> 
(shortened)
> 
> In the first error, the problem seems to be that the GetFontCollection 
> function is overloaded and C doesn't allow the same name for two members of a 
> struct.
> 
> If anyone can indicate a fix for one of these errors, I will prepare a patch.


First of all, note that in Microsoft SDK, <dwrite.h> seems to 
ignore plain C completely and it requires C++. So even when 
<dwrite.h> in mingw-w64 gets "fixed", any code using it shall
become "mingw-w64 specific" and incompatible with MS SDK.

So the question is whether it is better to follow MS (and possibly
remove all C-specific hacks from <dwrite.h> to not send false signals),
or whether there is any sense in "making mingw-w64 better then original"
and fix it.

In the latter case, mingw-w64 can be "fixed" by renaming the inherited 
methods (i.e. those wrapped by __cplusplus guard) which collide with
a method defined directly in the given interface.

For C++, this does not break anything, so compatibility with MS shall 
be preserved.

So, if maintainers want to go that way, you may e.g. rename 
GetFontCollection() on the line 1937 to something like 
IDWriteTextFormat_GetFontCollection() and ditto for all the other 
collisions. Such "fix" is quite trivial.

It may look ugly, but consider that in C++, non-virtual method 
of the same name shadows the one inherited from the base class, so
calling it is also less straightforward:

class A { 
public: 
        void foo(void)   {}
};

class B { 
public: 
        void foo(int x)   {}
};

int
main(int argc, char** argv)
{
    B b;
    b.foo();     // compile time error (the only considered candidate is 
B::foo() but that one requires int argument).
    b.A::foo();  // ok
    return 0;
}


Martin


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to