Sign in to follow this  
Zukix

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

Recommended Posts

Zukix    142
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this