Managed C ++ std :: string is not available in Unmanaged C ++

In an unmanaged C ++ dll, I have a function that takes a constant std::stringas an argument

 Prototype : void read ( const std::string &imageSpec_ )

I call this function from a managed C ++ dll by passing std::string.
When I debug unmanaged C ++ code, the parameter imageSpec_shows the value correctly, but does not allow me to copy this value to another variable.

 imageSpec_.copy( sFilename, 4052 );

Shows the length imageSpec_as 0 (zero).
If I try to copy like std::string sTempFileName(imageSpec_);, this line of the newline operator will be an empty line.

But for std::string sTempFileName(imageSpec_.c_str());this statement line is copied correctly. those. with character string copied correctly.

Copying this method will require a significant change in unmanaged C ++ code.
I am creating unmanaged code in Visual Studio 6.0 and managed C ++ in Visual studio 2008.
Is there any specific parameter or code change in managed C ++ that solves the problem?

+3
source share
1 answer

I am creating unmanaged code in Visual Studio 6.0 and managed C ++ in Visual Studio 2008.

Visual Studio 6.0 std::string std::string Visual Studio 2008. ++ DLL, - , ( ) , .

.dll, , / .dll, C-.


. this .

+1

Source: https://habr.com/ru/post/1736668/


All Articles