-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use COM interfaces from plain C #433
Comments
Those COM interface definition matches with Windows SDK. Should those be used in C code? |
I shall point out I have no experience with using COM from C and I am not all that familiar with COM. However, looking at it I'm like 80% sure that the COM interface declarations in It is a bit surprising that these declarations have been broken for more than 10 years and nobody has reported to either Microsoft or mingw-w64, but it also kind of make sense that it is probably quite rare for developers to use pure C for COM. However, with a cursory search I did find someone else documenting this issue in 2015: https://github.com/andlabs/winiconview/blob/master/progressdialog.c The proper way going forward is to first get Microsoft to fix their SDK headers. Perhaps https://developercommunity.microsoft.com/cpp is the place to report the issue? (There had been precedence of MS fixing headers for C, e.g. this issue with return value, so they might actually fix this one too if they are made aware about it.) Since mingw-w64 tries to be somewhat compatible with them, it may not make sense for mingw-w64 to implement a workaround on its own. However, this discussion should happen on the mingw-w64-public mailing list. |
Hi, thanks for replying. I was using mingw dated 2018. I can't find now the webpage from where I downloaded it, but these are the first lines from build-info.txt:
I don't know when become unusable, but for sure it was working fine in that version. BTW, I was using mingw in 32 bit mode. But now, I'm moving my code to 64 bit, so I decided to use this distro just because it supports 32 and 64 bit from one unique package, and I need to support also 32 bits yet. I'm aware that the underlying compiler is llvm-clang instead of gcc, but I expect no big problem about it. I'll try to workaround this problem and go on. Even if I have to modify some header files from mingw :-( Thanks again! |
Hi,
I've noticed that COM interfaces are not fully declared in order to be used from plain C, and I'm getting errors in my code. For example, this is the IProgressDialog at shlobj.h:
And this is the same interface in my current (rather old) mingw:
As you can see, the methods inherited from IUnknown are not declared now, so I cannot call them. This code:
obj->lpVtbl->Release( obj );
causes: "error: no member named 'Release' in 'struct IProgressDialogVtbl'"
So, the question is: How should I use COM interfaces from plain C? How may I call those inherited methods?
TIA
The text was updated successfully, but these errors were encountered: