I am working in a project in that i have a native(c++) application and a COM DLL(c# .Net). My requirement is, form my native application I want to call a function in COM DLL, and that function returns string(out parameter).
Bellow is the code
C# COM Code....
[ComVisible(true)]
public interface IUserDetais
{
bool GetUserConfigData(out string configData);
}
[
ComVisible(true),
ClassInterface(ClassInterfaceType.None),
GuidAttribute("GUID"),
]
public class AppUserDetais : IUserDetais
{
public bool GetUserConfigData(out string configData)
{
configData = "Some JSON content.";
reurn true;
}
}
C++ code
void GetUserInfo(IUserDetais* pUserInfo)
{
// TODO, How to call the function. what should be the signature in C#(the out string length can vary and how to delete the memory allocated).
//pUserInfo->GetUserConfigData();
}
Can any one tell me how to to call GetUserConfigData in C++ code.
Updated:
C++ is not .Net code. it is C++ win32 or native code.