Marshalling string from c# to c++
问题 I am new in microsoft world. I have lot of problem trying to pass a simple string from c# to dll/c++ I have read a lot of post and documentation about but the problem is the same. C++ code extern "C" __declspec(dllexport) int Init( long l , char* url ); C# code [DllImport("MCRenderer.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = false)] public static extern int Init(long a, StringBuilder url); Init(hndl.ToInt64(), str ); what haeppen is that long value is passed correctly