I'm using a simulink function block to generate a function that is going to be integrated into an external project.
The desired function prototype has been configured as below. Here, the function has a return value.
However, in the generated source file, the function is defined in the following way:
// Function Definition
void s16_eeprom_read_block(uint16_T ou16_BlockNumber, int16_T *rty_s16_ErrorFlag)
// Algorithm Implementation
// Function Declaration
extern int16_T s16_eeprom_read_block(uint16_T ou16_BlockNumber);
As we can see, the function doesn't have any return value according to its definition. Instead, this value has been replaced with a reference. As for function declaration, it is just what I desired.
Since this function has to be called and its return value has to be evaluated in the project, this mistake will lead to a compilation error.
I have deleted all of the generated files and tried to generate code again, but it didn't help.
In addition, my MATLAB version is R2018a. I think it may be a bug of simulink function since years ago, because this problem also occured while using earlier versions.
Is there anyone who can help me to solve this problem? Thank you!