digitalmars.D.learn - Using COM. Please help.
- Nub Public (10/10) Jun 26 2011 Hi. I've been trying to use Direct2D and I ran into some problems.
- Andrej Mitrovic (10/10) Jun 26 2011 You mean COM interfaces? I usually do this:
- Nub Public (14/24) Jun 27 2011 Thanks for the reply. But it still doesn't work.
- David Nadlinger (5/7) Jun 27 2011 I don't know if there is something COM-specific going on, but you might
- Nub Public (2/9) Jun 27 2011 It works now. Thanks.
Hi. I've been trying to use Direct2D and I ran into some problems. 1. When translating the headers from the Windows SDK, what linkage should I use for the interfaces? Currently I use none and it works, but I want some confirmation in case something comes up later and bites my in the ss. 2. Some members in the Direct2D interfaces are inlined. This gives me access violations when I declare and use them in my files. I guess those members are not exported to the Direct2D dlls. But there's no inline keyword in D. How do I solve this? Help please.
Jun 26 2011
You mean COM interfaces? I usually do this: interface SomeComInterface : IUnknown { extern(Windows): BOOL PrototypeFoo(); } But maybe this is already implicit when deriving from IUnknown, I wouldn't know. But from what I can tell some of those prototypes seem to have C linkage, maybe you're getting access violations due to wrong calling conventions.
Jun 26 2011
On 6/27/2011 1:28 PM, Andrej Mitrovic wrote:You mean COM interfaces? I usually do this: interface SomeComInterface : IUnknown { extern(Windows): BOOL PrototypeFoo(); } But maybe this is already implicit when deriving from IUnknown, I wouldn't know. But from what I can tell some of those prototypes seem to have C linkage, maybe you're getting access violations due to wrong calling conventions.Thanks for the reply. But it still doesn't work. interface ISomeComInterface : IUnknown { void funcWithManyParams(/*10 params*/); extern(/*insert whatever linkage here*/) void funcWrapperWithLessParams(/*3 params*/) { funcWithManyParams(/*fill in some default params*/); } //this func is inlined in the MS SDK header } DMD complains that the function body of funcWrapperWithLessParams isn't abstract.
Jun 27 2011
On 6/27/11 9:04 AM, Nub Public wrote:DMD complains that the function body of funcWrapperWithLessParams isn't abstract.I don't know if there is something COM-specific going on, but you might want to mark the wrapper method »final« – that's at least how it works for normal interfaces. David
Jun 27 2011
On 6/27/2011 4:08 PM, David Nadlinger wrote:On 6/27/11 9:04 AM, Nub Public wrote:It works now. Thanks.DMD complains that the function body of funcWrapperWithLessParams isn't abstract.I don't know if there is something COM-specific going on, but you might want to mark the wrapper method »final« – that's at least how it works for normal interfaces. David
Jun 27 2011