Link to home
Start Free TrialLog in
Avatar of SubodhKatiyar
SubodhKatiyar

asked on

Atl Problem: Passing variants array to .NET assembly expecting object from ATL dll

Hi experts
I have an atl component which is a leaf invoker component ,ie, it takes progids, input parameters, output parameters and one error string parameter it instanciates the component, and it uses dispatchdriver to invoke the function in question in a given component, the interface is given below.

interface ICgateway : IDispatch
{
      [id(1), helpstring("method Invoke")] HRESULT Invoke([in] VARIANT * param1,[in]  VARIANT* param2 ,[in,out]VARIANT* param3,[in,out] VARIANT* param4);
};
progid of a vb or vc com dll in param one, the input parameters to be passed to the component in question goes in param 2 as variant array, param 3 is for out values it is also variant array, and any error message is returned via param 4 this is BSTR type.

This component works fine as long as i give in progids of vb components which accept variants array as param2 and param3 parameters.

I have some .NET classes to be called  but they accept object as parameter i have no idea how do i convert my variants array to objects so that i can  pass them to .net component.

All components have same funcion signature and same type of parameter; that is,

   somefunct( byval variant inparam, variant outparam, variant errstring) as long

only .NET components have object array as input and output parameter.

Ccan anyone help me out with this one? ...
regards
Avatar of SubodhKatiyar
SubodhKatiyar

ASKER

as no one has answered this i am taking the question off.
i solved it by passing all byref and taking care while doing the marshaling that nothing gets back from in params
ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial