none
WP8 with C# and C++/cx,cstring cannot pass in and out c++/cx. RRS feed

  • Question

  • 0

    I am code WP8 with C# and C++/cx,cstring cannot pass in and out c++/cx.

    below is the code:

    private my_Cal.WindowsPhoneRuntimeComponent aadd=new my_Cal.WindowsPhoneRuntimeComponent();           

    ......

    name_box.Text = aadd.getname("123456");//code_box.Text
    temppass = aadd.getname("123456");

    String^ my_Cal::WindowsPhoneRuntimeComponent::getname(String^ disk_num)//(string disk_num,string out_regname,string out_regnum)
    {
    ......

     wchar_t msg[31]=L"ok1234";
     return (ref new String(msg));

    }

    The string "123456" is passed in the C++/Cx function aadd,but the getname can't return "ok1234";

    Tuesday, May 21, 2013 2:51 PM

Answers

  • Should work fine. What happens when you step through it in the debugger?
    • Marked as answer by yang2013yang Monday, May 27, 2013 2:53 PM
    Tuesday, May 21, 2013 3:42 PM
  • To debug your C++ component you need to:

    1. Right-click on the C# Project in the Solution Explorer

    2. Select "Properties"

    3. Click on the "Debug" tab

    4. Select "Native Only" for both "Debugger Types"

    • Marked as answer by yang2013yang Friday, May 24, 2013 12:56 PM
    Thursday, May 23, 2013 12:37 PM

All replies

  • I am code WP8 with C# and C++/cx,cstring cannot pass in and out c++/cx.

    below is the code:

    private my_Cal.WindowsPhoneRuntimeComponent aadd=new my_Cal.WindowsPhoneRuntimeComponent();           

    ......

    name_box.Text = aadd.getname("123456");//code_box.Text
    temppass = aadd.getname("123456");

    String^ my_Cal::WindowsPhoneRuntimeComponent::getname(String^ disk_num)//(string disk_num,string out_regname,string out_regnum)
    {
    ......

     wchar_t msg[31]=L"ok1234";
     return (ref new String(msg));

    }

    The string "123456" is passed in the C++/Cx function aadd,but the getname can't return "ok1234";

    Tuesday, May 21, 2013 2:49 PM
  • Should work fine. What happens when you step through it in the debugger?
    • Marked as answer by yang2013yang Monday, May 27, 2013 2:53 PM
    Tuesday, May 21, 2013 3:42 PM
  • I cannot debug in C++/cx function,but look the return result,the result is ERROR.

              name_box.Text = aadd.getname("123456");//code_box.Text

    that is,name_box.Text is error,the debuger show of VS2012 is not "ok1234".

    Tuesday, May 21, 2013 11:00 PM
  • To debug your C++ component you need to:

    1. Right-click on the C# Project in the Solution Explorer

    2. Select "Properties"

    3. Click on the "Debug" tab

    4. Select "Native Only" for both "Debugger Types"

    • Marked as answer by yang2013yang Friday, May 24, 2013 12:56 PM
    Thursday, May 23, 2013 12:37 PM