C++ interface vs D and com
John via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 13 01:34:55 PDT 2016
On Wednesday, 13 July 2016 at 07:31:57 UTC, Adam Sansier wrote:
> void** ptr = null;
> auto res = CoCreateInstance(&CLS_ID, cast(IUnknown)null,
> CLSCTX_INPROC_SERVER, &CLS_ID, cast(void**)&ptr);
How are you casting your "ptr" variable (which BTW should be just
void* or usually IUnknown) to your interface? A common mistake if
you're used to C++ is using cast(ISomeInterface*)ptr - which
would cause access violations - instead of
cast(ISomeInterface)ptr.
More information about the Digitalmars-d-learn
mailing list