A std::wstringis a C ++ object allocated by the C ++ runtime and has an internal implementation-dependent format. You may be able to figure out how to create one of them in a C # program and pass it to unmanaged C ++ code, but it will be somewhat difficult and fraught with danger. Since the internal structure std::wstringis implementation dependent, any change in the C ++ compiler or runtime libraries interrupts your decision.
, , ++, LPTStr, std::wstring, ++, . , , , :
int Foo(std::wstring p);
:
int FooCaller(LPTSTR p)
{
std::wstring str = p;
return Foo(str);
}
FooCaller #.
, # std::wstring, .