Good Day fellow developers
I have been searching the internet for 2 days now on how to do what I need and I have tried a lot of samples with no success. However, that does not mean I covered all sites - I am thinking I am blind in one eye and cannot see out the other.
At any rate, I was handed a single sheet of paper with a COM Automation Interface definition on it and was asked to develop a C# application to utilize the interface and the callbacks accordingly.
So, starting simple (or so I thought) - the C++ method signature is:
STDMETHODIMP CSimpleChatServer::CallMe(BSTR clientName, BSTR** returnMessage)
and the interface signature is:
HRESULT _stdcall CallMe([in] BSTR clientName, [in] BSTR** helloMessage);
And I need to call this from C# - I have established the Interface for ISimpleChatServer; hence, the code call I am trying is like.
string rtrnMsg = string.Empty;
ImySimpleCom.CallMe("Robert", rtrnMsg)
Since the signature is an [in], I am getting an exception on trying to access protected memory.
Now, I believe it wants an IntPtr as the second parameter; however, all my attempts to get that to be taken have failed.
Please keep in mind that I am not able to change the library - it is an "As Is" legacy interface that we need to utilize for a little while longer and the provider has nobody to update it accordingly (in fact I think they do not have anyone to work on it).
Any help would be kindly welcomed.
Kind Regards, Robert S.