error C3767: candidate function(s) not accessible + COM interface pointers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Antonio Carvalho

    #1

    error C3767: candidate function(s) not accessible + COM interface pointers

    I am getting this compler error in similar situations as described in
    previous posts to this site, however in my case the solution that is
    proposed is of no use.

    In my case, the managed C++ class has a method that takes a COM Interface
    pointer that is imported from a typelib and hence it is not possible at all
    to forward-declare it, otherwise I will be getting a C2011 type redefinition
    error.

    I've tried several solutions but have had no luck whatsoever.

    Regards,
    Antonio




  • Antonio Carvalho

    #2
    Re: error C3767: candidate function(s) not accessible + COM interface pointers

    Ok, in all fairness, I realize that what I wrote before is not all that
    clear. Nothing like a good case study!!!

    I have a managed class A that contains a COM interface pointer as a member,
    which in this case I will just use the well known IDispatch. I then want to
    access this member from another Managed object of class B which resides in a
    different module (dll). So I add a member to A that will return the
    IDispatch pointer and have B try to call that method on an instance if A.
    Here is the code to help get a better picture:


    ////////////////////////////////////////////////////////////////
    // A.h

    #pragma once
    #include <Oaidl.h>

    namespace C3767
    {
    public ref class A
    {
    public:
    A(void):
    m_pDispatch(NUL L)
    {
    }

    IDispatch* getDispatch()
    {
    return m_pDispatch;
    }

    private:
    IDispatch* m_pDispatch;
    };
    }


    ////////////////////////////////////////////////////////////////
    // B.h

    #pragma once
    #include <Oaidl.h>

    namespace C3767
    {
    public ref class B
    {
    public:
    B(void) {}

    void func()
    {
    A^ a = gcnew A();
    a->getDispatch( );
    }
    };
    }

    The call to getDispatch will issue the C3767 error that has been discussed
    in two other topics. Unfortunately in this case the unmanaged class is an
    interface and not an exported class from a dll.

    Any ideas???
    Antonio


    Comment

    Working...