2

I have a C# interface which looks like this:

public interface ITdcConnector
{
    void Close(uint);
    void FetchRequestAsync(ManagedFetchRequest);
    UInt32 Open(String, Action<uint, ManagedFetchResponse>, out Int64);
}

I am trying to implement in C++/CLI like this:

public ref class MockTdcConnector : public ITdcConnector
{
public:
    virtual Void Close(UInt32);
    Void FetchRequestAsync(ManagedFetchRequest);
    UInt32 Open(String, Action<UInt32, ManagedFetchResponse^>^,
      [System::Runtime::InteropServices::Out] Int64%);
};

IntelliSense is giving me grief on the Open() method. It tells me: IntelliSense: class fails to implement interface member function "ITdcConnector::Open"

I've looked at a few relevant examples on implementing C# classes in C++/CLI, but no luck. Any idea on how to get the C++/cli method signature to look like the C# method?

0

1 Answer 1

2

So, I didn't see this until just now. I started typing the name of the C# method in the C++/cli class and IntelliSence showed the method signature it was expecting. I just needed some more ^s and virtuals.

Here is what I ended up using, for future reference:

public ref class MockTdcConnector : public ITdcConnector
{
public:
    virtual Void Close(UInt32);
    virtual Void FetchRequestAsync(ManagedFetchRequest^);
    virtual UInt32 Open(String^, Action<UInt32, ManagedFetchResponse^>^
      [Runtime::InteropServices::Out] Int64%);
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.