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

2 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by