C function prototype of a simulink function is not correctly configured as desired in generated code
4 views (last 30 days)
Show older comments
Hello everyone,
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194092/image.png)
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!
4 Comments
Nick Sarnie
on 3 Sep 2018
Hi Xiaojie,
Thanks for letting me know. If you are able to reproduce either of those issues, please reach out to Technical Support. They can work with my team to investigate further.
Thanks, Nick
Answers (0)
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!