How to COM interfaces work
StarGrazer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 18 20:27:28 PDT 2017
On Sunday, 19 March 2017 at 03:10:02 UTC, Adam D. Ruppe wrote:
> On Sunday, 19 March 2017 at 02:04:53 UTC, StarGrazer wrote:
>> If I use it as a pointer in to the the D interface equivalent,
>> it crashes as the value is not pointing to anything valid.
>
> What's the code look like? What interface too?
It's very complicated. I use a lot of reflection to extract the
interface functions and build a d class from them.
Like I said, the initial dynamic COM interface works fine. I can
call it's functions so all that code is irrelevant.
The problem is, some of those functions return COM
interfaces(they inherit IDispatch interfaces in D).
The interfaces are generated from idl2d. So they are just
standard d interfaces that only mock up the COM interfaces.
But it is probably not a D issue.
IDispatch.Invoke returns a COM VARIANT type with the return
type(which is an IDispatch interface according to idl2d).
HRESULT CoCreateInstance(
_In_ REFCLSID rclsid,
_In_ LPUNKNOWN pUnkOuter,
_In_ DWORD dwClsContext,
_In_ REFIID riid,
_Out_ LPVOID *ppv
);
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686615(v=vs.85).aspx
I assume I'll have to use that to create the COM of COM by
passing the returned value from invoke in to the pUnkOuter and do
all that. I haven't tried it yet but will when I get a chance.
I'd just like to get some conformation on the process so at least
I know I'm headed in the right direction. The project is pretty
complex and most of the stuff is done in compile time code.
More information about the Digitalmars-d-learn
mailing list