Where is the declaration and definition of C code corresponding to min,max,abs blocks

15 ビュー (過去 30 日間)
Nagaraj Chincholli
Nagaraj Chincholli 2020 年 2 月 26 日
編集済み: stozaki 2020 年 3 月 7 日
Hi,
If min,max,abs etc blocks related to math operations are used in simulink model, C functions corresponding to these blocks are generated in code i.e. fmaxf(), fminf(), fabsf().
For these functions, where the declaration and defintion is present? During compilation from which path declaration and definition of the function is fetched.
Can someone help me in understanding this?
Thanks in advance

回答 (2 件)

stozaki
stozaki 2020 年 3 月 7 日
編集済み: stozaki 2020 年 3 月 7 日
math.h is standard library. So, mathematical functions are defined in math.h.
for example, If you use MinGW compiler, you can find following folder.
MinGW\include\math.h

stozaki
stozaki 2020 年 2 月 26 日
編集済み: stozaki 2020 年 2 月 26 日
For example, min block generate model.c and model.h.
math.h is included in model.h
  1 件のコメント
Nagaraj Chincholli
Nagaraj Chincholli 2020 年 3 月 7 日
Hi stozaki,
I am elaborating my query.
Target selection : autosar.tlc
Case 1 : If I set the option In the model configuration parameters -> Code generation -> Interface -> Advanced parameters -> Standard math library as C89/90(ANSI), code for the abs,max and min block is generated as in the attachment C89_90_code.PNG.
In the C89/C90 (ANSI) standard, there are no standard functions so the c code for these blocks is generated in model.c file
Case 2 :If I set the option In the model configuration parameters -> Code generation -> Interface -> Advanced parameters -> Standard math library as C99(ISO), code for the abs,max and min block is generated as in the attachment C99_code.PNG.
Here, fabs(),fmin(),fmax() are generated whose declarations are included in <math.h>, I understood. I want to know in which file the definition of these functions is present?
Could you please clarify.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by