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

2 views (last 30 days)
Louis Vallance
Louis Vallance on 9 Sep 2013
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
Fred Smith
Fred Smith on 12 Sep 2013
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.

Sign in to comment.

Answers (0)


Community Treasure Hunt

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

Start Hunting!