See the question and my original answer on StackOverflow

You should not return BSTR (or any "complex" type that various compilers compile in various ways). The recommended return type for COM methods is HRESULT (a 32-bit integer). Also, you must not release a BSTR you just allocated and return it to the caller.

Here is how you could layout your methods:

HRESULT STDMETHODCALLTYPE TVImpl::Login(BSTR PassWord, /*out*/ BSTR *pRead)
{
  ...
  *pRead = ::SysAllocString(L"blabla"); // allocate a BSTR
  ...
  // don't SysFreeString here, the caller should do it
  ...
  return S_OK;
}

If you were defining your interface in a .idl file, it would be something like:

interface IMyInterface : IUnknown
{
    ...
    HRESULT Login([in] BSTR PassWord, [out, retval] BSTR *pRead);
    ...
}

retval is used to indicate assignment semantics are possible for languages that support it, like what you were trying to achieve initially with code like this var read = obj.Login("mypass")