Hi, I am running mono on windows.
I have a simple ASP.Net form with a text box, a label, and a button. When the button is pressed it calls a dll that takes the text from the text box and returns a new string to replace it and the size of the new string is returned as well for debugging purposes. This all works fine when running the page under the .Net framework but running under XSP causes a strange result. The size value of the string returned is what I expect (matches .Net) and suggests that the dll is working properly but the string itself is always only one character long. Can anyone tell me what I am doing wrong. Vin Here is the code //////////////////////////////////////// // C# public partial class _Default : System.Web.UI.Page { [DllImport("C:/interop/release/Controller.dll", EntryPoint = "Execute")] private static extern void Execute([MarshalAs(UnmanagedType.LPWStr), In] string commandIn, [MarshalAs(UnmanagedType.LPWStr), Out] out string commandOut, out int size); protected void Button1_Click(object sender, EventArgs e) { string commandOut; int stringSize; Execute(TextBox1.Text, out commandOut, out stringSize); TextBox1.Text = commandOut; Label1.Text = stringSize.ToString() + ":" + commandOut.Length.ToString(); } ///////////////////////////////////// // C++ void Execute(wchar_t* pIn, wchar_t*& pOut, int* pSize) { std::wstring test = pIn; test = test + test + test; test += L'\0'; const unsigned int c_size = sizeof(wchar_t) * test.size(); *pSize = c_size; pOut = reinterpret_cast<wchar_t*>(malloc(c_size)); std::copy(test.begin(), test.end(), pOut); } _______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list