If an FMU contains source code and is statically linked, the FMI function names should be prefixed with the modelIdentifier. To achieve this, the FMI3_FUNCTION_PREFIX macro must be defined before the #include "fmi3Functions.h".
Source Code FMUs 3.0 that are generated with the FMI Kit for Simulink define the macro too late.
Code snippet from fmi3Functions.c:
#include "fmi3Functions.h"
#include <float.h> /* for DBL_EPSILON, FLT_MAX */
#include <math.h> /* for fabs() */
#include <string.h> /* for strdup() */
#include <stdarg.h> /* for va_list */
#include <stdio.h> /* for vsnprintf(), vprintf() */
#include "fmiwrapper.inc"
The macro FMI3_FUNCTION_PREFIX is defined in fmiwrapper.inc
That is, the prefix is not used for building the function names. As a result, the FMU cannot be used in a simulation environment that provides a fmi3Functions.h file that constructs the function names with FMI3_FUNCTION_PREFIX as described in the FMI 3.0 specification.
If an FMU contains source code and is statically linked, the FMI function names should be prefixed with the modelIdentifier. To achieve this, the
FMI3_FUNCTION_PREFIX
macro must be defined before the#include "fmi3Functions.h"
. Source Code FMUs 3.0 that are generated with the FMI Kit for Simulink define the macro too late. Code snippet fromfmi3Functions.c
:The macro
FMI3_FUNCTION_PREFIX
is defined infmiwrapper.inc
That is, the prefix is not used for building the function names. As a result, the FMU cannot be used in a simulation environment that provides a
fmi3Functions.h
file that constructs the function names withFMI3_FUNCTION_PREFIX
as described in the FMI 3.0 specification.