• Advertisement
Sign in to follow this  

[.net] Access 'fixed array' from C++\Cli

This topic is 3653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a struct declared in C# using a fixed array which I wish to access from C++\CLI but I receive the compiler error: error C2109: subscript requires array or pointer type It appears that a fixed array has no methods and is not a pointer. Please help! e.g. Definition in C#
    [StructLayout(LayoutKind.Sequential)]
    public unsafe struct UpdateStruct
    {
        [XmlIgnore]
        public fixed float m_afArray[10];
        public bool test;
    }


Use in C++\CLI
UpdateStruct * u = GetUpdateStruct();
u->test = false;     // Ok
u->m_afArray[0] = 0; // error C2109: subscript requires array or pointer type


thanks! [Edited by - Zukix on February 22, 2008 7:39:12 AM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement