I have a dll that was written in c#, and I used this dll in my c++ code(exactly MFC). I can use dll function with return value int, string... But I need to use a function with return value c# class! I don't know what kind of data type in MFC for putting in the function's return value in c# dll. c# return value object is convert to _variant_t in MFC. Please help me. Thank you for reading my question
C# code (abstract)
[Guid(" - - - - ")]
public interface ITestClass
{
object Func();
}
[Guid(" - - - - ")]
public class TestClass : ITestClass
{
public object Func()
{
Project1.Class1 data = dataList[0];
return data ;
}
}
MFC code (abstract)
ITestClass *ptc = NULL;
CoInitialize(NULL);
HRESULT hr = CoCreateInstance(CLSID_TestClass, NULL, CLSCTX_INPROC_SERVER, IID_ITestClass, reinterpret_cast<void**>(&ptc));
int sum = ptc->Sum(5, 30); // It is perfect
data = ptc->Func(); // I don't know what data type is