views:

10

answers:

1

I use COM interop to call functions in a c# dll from my VC6 MFC DLL, and this works fine.
I want to call a function to retrieve string values.
How do I declare a 'string' in my unmanaged C++?
How should the 'string' appear in the c# code?
Currently the c# function in the dll takes ref string arguments, and my c# test app works fine, but what do I pass from an unmanaged c++ call?

Hope this makes sense. Any help welcome, Thanks.

A: 

Problem solved.

I create a BSTR variable in my VC6 code:
BSTR key = SysAllocString(NULL);
I call my C# assembly:
presenter->GetObject(&key);
My C# function is:
void GetObject(ref string key);

:)

Cokes