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
Programming Languages-OtherProgramming

Avatar of undefined
Last Comment
ee_ai_construct
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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Programming
Programming

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.

55K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo