I hav created a com componet for some Display method in C# it returns a String List
as shown below. In v++ i hav used std::lst to catch the return value from Disp() but it
gives compiler error that Disp is not a member of class. I i make return type a s void then
it works fine. what i can modify so that Disp return a List and in main(c++) i have to use
this return value.
Public interface ITest
{
List<string> Disp();
}
class TestLib:ITest
{
List<string> Disp()
{
List<string> li=new List<string>();
li.Add("stack");
li.Add("over");
li.Add("Flow");
return li;
}
}
compiled and created Test.dll successfully and also test.tlb. Now in main function that is written in c++
#include<list>
#import "..\test.tlb"
using namespace Test;
void main()
{
HRESULT hr=CoInitialize(null);
ITestPtr Ip(__uuidof(TestLib));
std::list<string> li=new std::list<string>();
li=Ip->Disp();
}
What's wrong in my code when i try to compile this it shows
'Disp':is not a member of TestLib:ITest
how to solve this plz help me ....when i make it return type as void in Class it works fine .what mistake i did????