Hi all,
I need to
1. .Net dll with a method
public bool myMethod (string inVal, ref StringBuilder outVal)
{
string temp = "test";
int size = temp.Length;
StringBuilder res = new StringBuilder(size);
res.Append(Iterator.Current.Value);
outVal = res;
}
2. c++ program that calls this .Net dll
LPWSTR* outVal;
bool result = myMethod ("xyz",outVal);
I have not managed yet to get this working. I have a runtime error :
Windows has triggered a breakpoint in ATLtest.exe.
This may be due to a corruption of the heap, and indicates a bug in
ATLtest.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
What is the correct way to pass strings from a COM component to a .Net,
modify the string in .Net, and pass it back again to the COM component ?
Mattias Sjögren - 02 Jun 2005 13:34 GMT
>What is the correct way to pass strings from a COM component to a .Net,
>modify the string in .Net, and pass it back again to the COM component ?
Make the parameter type a ref string. It will marshal to a BSTR* on
the unmanaged side.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.