The problem with this example is that the size of the array on unmanaged side (C++) is unknown. I would say, your Question does not fully define your problem. You need this information. It this is passed to the C++ function (so it could work with any length) it is not a problem.
This code sample will give you an idea:
http://stackoverflow.com/questions/289076/how-can-i-pass-a-pointer-to-an-array-using-p-invoke-in-c[
^]. In this sample the assumed size of the array is some immediate constant. If this value is known before the call to the unmanaged function, it can be variable. It this is not the case, please explain how this size is defined and passed.
—SA