On Wednesday, 13 July 2016 at 02:41:22 UTC, Adam Sansier wrote:
If you can convince me to try it out, I might... but doing com isn't my primary goal here and I seem to have finished up what I was trying to achieve(my use case is probably relatively simple though). Last thing I want to do is get bogged down in this stuff, which feels clumsy and not well documented(Both the D and C sides)

Juno is definitely of more value if you're trying to access standard Windows COM objects, that way you don't have to write the interface definitions yourself.

You'd mentioned that you got it work with a hack and there should be a better way, Juno might be that better way.

It looks to me like your extern(C++) is needed because you're trying to shove the pointer from coCreateInstance into a D class. With COM you don't work with concrete classes, only interfaces. Code below is not tested and only from limited knowledge.

    IMYCASIO cASIO : IUnknown
    {
        void func1(char *name);
        void func2(int);
    }

    //...
    IMYCASIO obj;
    CoCreateInstance(..., cast(void**) &obj);

    obj.func1("me");

The only other thing I can think is, if you are obtaining an object that defines static methods, those aren't supported by COM. COM only works on virtual functions and you're probably just hacking memory address space to get at those functions.

Reply via email to