B
breathwell
Consider a C# function that logs an error string and returns a new
Exception object:
System.Exception LogError(string msg)
{
...
return new Exception(msg);
}
In my program, this method is exposed to both .NET and COM clients.
For C++ COM client, the default translation of this method is as
follows:
virtual HRESULT __stdcall LogError (
/*[in]*/ BSTR msg,
/*[out,retval]*/ struct _Exception * * pRetVal ) = 0;
The problem that I'm having is that my COM client has no use for .NET
Exception being returned to it. Is it possible (via some attribute?)
to make the compiler discard the Exception return type, so that the
generated function signature is like this (ie. discards the Exception
return type):
virtual HRESULT __stdcall LogError (
/*[in]*/ BSTR msg ) = 0;
or in other words, corresponds to C# signature of "void
LogError(string)"? I've looked at [return: MarshalAs(...)] attribute
but this doesn't let me "void"/discard the Exception return.
Many Thanks.
-K
Exception object:
System.Exception LogError(string msg)
{
...
return new Exception(msg);
}
In my program, this method is exposed to both .NET and COM clients.
For C++ COM client, the default translation of this method is as
follows:
virtual HRESULT __stdcall LogError (
/*[in]*/ BSTR msg,
/*[out,retval]*/ struct _Exception * * pRetVal ) = 0;
The problem that I'm having is that my COM client has no use for .NET
Exception being returned to it. Is it possible (via some attribute?)
to make the compiler discard the Exception return type, so that the
generated function signature is like this (ie. discards the Exception
return type):
virtual HRESULT __stdcall LogError (
/*[in]*/ BSTR msg ) = 0;
or in other words, corresponds to C# signature of "void
LogError(string)"? I've looked at [return: MarshalAs(...)] attribute
but this doesn't let me "void"/discard the Exception return.
Many Thanks.
-K