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

3 visualizzazioni (ultimi 30 giorni)
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 Commenti
Ryan Livingston
Ryan Livingston il 11 Set 2013
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 il 12 Set 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.
-Fred

Accedi per commentare.

Risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by