3

I'm trying to create a runtime component which supports windows phone 8. Brief Description of the Program is as :

  1. Application (C#) is going to fill some data in ref struct A
  2. It will call init API of ref class VVoiP with object of ref struct A.
  3. Ref class VVoip needs to have a array of objects of class B, so that it can have multiple instances.

C # Code :

using TestWRC;
namespace TestPrj
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            VVoIP v1 = new VVoIP();
            A a1 = new A();
            a1.a = 10;
            v1.init(a1);
        }
    }
}

C++ Code :

    namespace TestWRC
    {
    public ref struct A sealed
        {
    public:
        property int a;
    };

    struct B {
        A^ A_obj;
    };

    public ref class VVoIP sealed
    {
    private:
        B array[3];   /* Array of object to have multiple instance */

    public:
        void init(A a1);
    };
    }


using namespace TestWRC;
    void VVoIP::init(A a1)
    {
    array[0].A_obj->a = a1.a;  /* Filling local array with initialized data*/
    }

the following errors coming from the above code:

error C3992: 'init':signature of public member contains invalid type 'TestWRC::A'

I am new to Windows phone 8, would somebody please say me what is this error, and how to rectify this. Thanks in advance.

McGarnagle
  • 101,349
  • 31
  • 229
  • 260
Kanika Mittal
  • 31
  • 1
  • 2

1 Answers1

3

Your public signature needs to specify that this is a Windows Runtime reference counted object, so you need to declare with the hat (^) syntax.

void init(A^ a1);
Paul Annetts
  • 9,554
  • 1
  • 27
  • 43