I'm generating code for a simple logic as per below:
Because in the model settings I'm supporting 'non-finite numbers', multiple functions are generated to deal with those. All are inside the model.c file which is exactly what I want - all self contained in a single file. All but one of those functions are marked as static which makes sense, since the model.h doesn't export any of them. However, for one function (and also some variables) 'extern' specifier is used. I don't understand why, since none of those functions/variables are present in the header file. This creates a headache for me, since if I generate code for two models independently I end up with two functions, named exactly the same, in each of the model.c files. The linker isn't particularly happay about it.
Here's the code:
#include "untitled1.h"
#define NumBitsPerChar 8U
extern real_T mymodel_rt_powd_snf(real_T u0, real_T u1);
static real_T rtGetInf(void);
static real32_T rtGetInfF(void);
static real_T rtGetMinusInf(void);
static real32_T rtGetMinusInfF(void);
static real_T rtGetNaN(void);
static real32_T rtGetNaNF(void);
extern real_T rtInf;
extern real_T rtMinusInf;
extern real_T rtNaN;
extern real32_T rtInfF;
extern real32_T rtMinusInfF;
extern real32_T rtNaNF;
Any idea how to make all functions/variable file scoped (except obviosuly _step and _initialise functions)?
Below are the relevant settings:
UtilityFuncGeneration 'Auto'
SupportNonFinite 'on'
ERTFilePackagingFormat 'Compact'
PreserveExternInFcnDecls 'on'
PreserveStaticInFcnDecls 'on'