C++ interface vs D and com

John via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 13 13:47:21 PDT 2016


On Wednesday, 13 July 2016 at 20:28:40 UTC, Adam Sansier wrote:
> On Wednesday, 13 July 2016 at 19:22:44 UTC, Kagamin wrote:
>> On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote:
>>> There's a lot of misinformation on the net.
>>
>> Nope, it's just you. COM support in D and in general works 
>> fine for everyone else.
>
> For anyone else having similar problems please ignore. COM 
> doesn't work perfectly regardless of what some nobody says and 
> I'm not the only one having problems. There are others and a 
> search shows this.
>
> http://forum.dlang.org/thread/iovu2e$2d3d$1@digitalmars.com
>
> I notice you are the last one to say "COM uses stdcall 
> convention. Everything else is not COM." Spreading your lies 
> and disinformation. People like you are a source of problems, 
> not a solution. Please learn that you don't know everything and 
> your generalization about how everything works is simply wrong.
>
> http://www.digitalmars.com/d/archives/digitalmars/D/learn/thiscall_calling_convention_4943.html
>
> Regardless of why the problems exist, or if they are subtle or 
> only in certain scenarios, they exist and some imbecile 
> claiming they don't just makes more trouble for those trying to 
> solve their problems.
>
> If you don't like my attitude, stop acting like the world is 
> perfect and when someone has a problem that it just might be 
> legitimate. If you don't actually feel like helping, simply 
> don't reply, it's that easy.

The problem is that ASIO deviates from the standard way of 
implementing COM. Other languages like Delphi expect COM to use 
stdcall too, so the problem is not unique to D. Putting 
"extern(C++):" before the interface method declarations should 
allow it to work...

interface IASIO : IUnknown {
   extern(C++):
   HRESULT SomeMethod();
}


More information about the Digitalmars-d-learn mailing list