Nobody knows this problem? Any recommendation would be highly appreciated!
C function prototype of a simulink function is not correctly configured as desired in generated code
조회 수: 5(최근 30일)
표시 이전 댓글
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.

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
Nick Sarnie
2018년 9월 3일
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
답변(0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!