Embedded Coder give uncompilable code using dynamic arrays

2 ビュー (過去 30 日間)
Marcus Mårdberg
Marcus Mårdberg 2020 年 9 月 14 日
回答済み: Ryan Livingston 2020 年 9 月 25 日
Hi,
When generating C++ code an error occurs. Using dynamic arrays (not statically reserved memory) in matlab results in generated code that uses data structures of type array and b_array, where b_array is undefined. Hence, trying to use Embedded Coder with Matlab 2020a might give uncompilable code.
Appreciate any feedback and help on this issue.
Regards,
M
  3 件のコメント
Glenn
Glenn 2020 年 9 月 22 日
I'm seeing the same problem. I've used a 'sed' script to simply change the 'b_array' references to 'array', and the code compiles and appears to work:
sed -i -e "s/b_array/array/g" *.{h,cpp}
Sumit Ghosh
Sumit Ghosh 2020 年 9 月 24 日
Hi Glenn,
Can you help us reproduce the issue so that we can fix it and/or offer a workaround.
Thanks,
Sumit.

サインインしてコメントする。

回答 (1 件)

Ryan Livingston
Ryan Livingston 2020 年 9 月 25 日
This is a bug and has been reported to our development team. In addition to the postprocessing workaround suggested by Glenn, you can disable coder::array if you're OK using emxArrays instead:
cfg = coder.config('lib');
cfg.DynamicMemoryAllocationInterface = 'C';
codegen f -args 1 -lang:c++ -config cfg -report

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by