Good day. I don't really know C ++, but I really need to write one library for use in C #. I can not create an array with a long dependent on another array.

Error: expression must have constant value

/////Класс для get_param_value_bynames /////////////// public ref class P_BYNAME_DATA { public: String^ PntName; //имя точки String^ PrmName; //имя параметра short nPrmOffset; //смещение параметра PARvalue* pupvValue; //(входной/выходной) значение пара-метра short nType; //(входной / выходной) тип значения long fStatus; //состояние каждого до-ступа к значению P_BYNAME_DATA() {} P_BYNAME_DATA(String^ name) { PntName = name; } virtual ~P_BYNAME_DATA() {} }; ///Класс для обращения public ref class Hscnapi { private: static int status; public: static int get_param_value_bynames(String ^Server, array<P_BYNAME_DATA^>^ prmdata) { int len = prmdata->Length; PARAM_BYNAME_DATA rgprmbd[i]; //Ошибка: выражение должно иметь константное значение } } 

In my opinion, you need to create a pointer to determine the size of the array or something else. But I dont know how.

  • I do not understand people who are minus anything without explanation. - Alexander Muksimov
  • PARAM_BYNAME_DATA rgprmbd [i] - swears right, PARAM_BYNAME_DATA rgprmbd [5] - will not swear. IMHO, in a nutshell, as you have done - you can’t do that at all. Either formulate the initial task that you need and then someone will be able to help you, or (it seems to me more correctly) - read about the standard containers with ++. - Alexander Muksimov
  • one
    Well, or just about new or gcnew - pavel
  • @Alexander Muksimov I need to create an rgprmbd array of the same size as prmdata. - zerpico
  • habrahabr.ru/post/111071 - Alexander Muksimov

0