How to deal with emxArray in multiple C++ function calls?

3 ビュー (過去 30 日間)
fsgeek
fsgeek 2013 年 9 月 9 日
Hi folks,
I'm not sure if this is a question for MATLAB answers, or whether it belongs somewhere like stackoverflow, since it concerns the handling of C++ code which has been generated from MATLAB code.
Essentially I have several functions, all of which pass arrays in and out of themselves. The C++ generated code has provided header and source files to define an emxArray for the array I/O of each function. The problem is that, for each MATLAB function, its respective emxArray header/source uses the same definitions e.g.
struct emxArray_real32_T % Used for function A
struct emxArray_real32_T % Used for function B, and so on
This creates a headache when building the code. I get a message like "struct emxArray_real32_T from function A already defined in function B".
Is it a case of renaming the emxArray for each function so that their names are specific to their function? e.g.
struct emxArrayFunA_real32_T; % For function A
struct emxArrayFunB_real32_T; % For function B
...
Thanks,
Louis
  2 件のコメント
Ryan Livingston
Ryan Livingston 2013 年 9 月 11 日
Can you please post the sections of the generated A_types.h and B_types.h which cause this? Please include any #ifdef, #define, #endif preprocessor macros which appear.
What release of MATLAB are you using?
Fred Smith
Fred Smith 2013 年 9 月 12 日
In the latest release (R2013b), you can modify these names if you have an Embedded Coder license to avoid clashes.
The original design intent for MATLAB Coder, is that you invoke code generation with all of your code in one shot using multiple entry points. This will avoid these name collision problems, but does not work for every use case.
-Fred

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

回答 (0 件)

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by