Currently I have some code that looks like this
void calc_run(Calculation *c, Input *i);
STDMETHODIMP CCalculation::run(IUnknown* input)
{
calc_run(calc,((CMyInputClass*)input)->get_input());
return S_OK;
}
In other words CCalculation::run wants a pointer to a CMyInputClass, but currently it takes IUnknown and downcasts.
Presumably this is bad.
But how can I specify more precisely to COM which object I want? I tried changing the .c, .h and .idl files but the compiler doesn’t recognise CMyInputClass* as a type specification in the idl.
interface ICalculation : IDispatch{
[id(2), helpstring("method run")] HRESULT run([in] CMyInputClass* input);
What is the correct way to do this?
The COM way would be to introduce a COM interface that
CMyInputClasswould implement and use that interface inrun()declaration: