locked
c++ - handle single-dimensional array in Microsoft Interface Definition Language RRS feed

  • Question

  • I followed the instruction at

    https://docs.microsoft.com/en-us/uwp/midl-3/intro

    try to use single-dimensional array in c++ winRT component

    Class.idl

    namespace MyClass
    {
        [default_interface]
        runtimeclass Class
        {
            Class();
            String[] aaa(String[] v);
        
        }
    }


    Class.h

    #pragma once
    
    #include "Class.g.h"
    
    namespace winrt::MyClass::implementation
    {
        struct Class : ClassT<Class>
        {
            Class() = default;
    
            hstring[] aaa(hstring[]  s);
     
        };
    }
    namespace winrt::MyClass::factory_implementation
    {
        struct Class : ClassT<Class, implementation::Class>
        {
        };
    }

    Class.cpp

    #include "pch.h"
    #include "Class.h"
    #include "Class.g.cpp"
    
    namespace winrt::MyClass::implementation
    {
    
      hstring[] Class::aaa(hstring[] s)
        {
            return null;
        }
     
    
    }

    but it reports error as below

    it looks like 'hstring[]' is not correct

    Is there any sample code for usage of single-dimensional array?

    thanks



    • Edited by aloha99 Saturday, September 5, 2020 2:32 PM
    Saturday, September 5, 2020 2:22 PM