when i try to call c# code from c++, i followed instructions from this article
http://support.microsoft.com/kb/828736
part of my c# is :
[Guid("6A2E9B00-C435-48f8-AEF1-747E9F39E77A")]
public interface IGameHelper
{
void getInfo(out string result);
}
public class GameHelper : IGameHelper
{
void getInfo(out string result)
{
result = new StringBuilder().Append("Hello").ToString();
}
}
part of my c++ code:
#import "../lst/bin/Release/LST.tlb" named_guids raw_interfaces_only
using namespace LST;
using namespace std;
...
HRESULT hr = CoInitialize(NULL);
IGameHelperPtr pIGame(__uuidof(GameHelper));
BSTR ha = SysAllocString(NULL);
pIGame->GetInfo(&ha);
wprintf(_T(" %s"),ha);
SysFreeString(ha);
but I just cannot get the string result value, it works fine when i try to get integer results,but not string.
I dont know COM very much. PLEASE HELP ME. Thank you.