Not seeing what I was looking for on S/O. I have a C# app that needs to pass values to a C++ CLI application (managed code). (I REALLY ONLY NEED TO FIGURE OUT STRING passing)
C# I have
double xCoordinate = 4820.85;
double yCoordinate = 9792.93;
string stringName = "My string stuff";
abc.Highlight(xCoordinate, yCoordinate, stringName);
In C++ / CLI I wish to receive the string (double seems just fine)
I read about the following
C++ --> std::wstring
or in C++ --> extern "C" __declspec void GetString( char* buffer, int* bufferSize );
C# --> void GetString( StringBuilder buffer, ref int bufferSize );
Perhaps
System::String^
const char *
? So it seems that I just wish to send string from C# to C++ / CLI while it would seem simple enough, I'm not trained in C++ and finding examples of Interop /marshalling does not seem so trivial.
If you're using C++/CLI, you can use String
directly:
void Highlight(double xCoordinate, double yCoordinate, String^ name)
{
//...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With