Hi Team,
Here's an issue from the customer may need your help:
The DCL_resetPID and updatePID functions in the DCL library are static inline. What should I do if I need to reset and update externally during use?
--
Thanks & Regards
Yale Li
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Team,
Here's an issue from the customer may need your help:
The DCL_resetPID and updatePID functions in the DCL library are static inline. What should I do if I need to reset and update externally during use?
--
Thanks & Regards
Yale Li
Yale, you should be able to include the corresponding DCL header file in the source file where you want to call these functions.
Thanks,
Sira
Hi Sira,
These header files have been already included. But resetPID is static inline function, cannot call it from outside.
--
Thanks & Regards
Yale
Yale,
'static' defines a function which has what's called 'internal linkage' in the standard. What it basically means is that the function is not available for any other translation unit besides the one in which it's defined.
So a.c + dcl.h is one unit, b.c + dcl.h is another. By putting a static inline function in a header, you tell the compiler to define that function in each translation unit in which it's used. a.c with dcl.h included can call the function, as can b.c with dcl.h included. But you will have two definition of that static inline function in the program's executable. This does not lead to a conflict because the linker knows which symbol is related to which unit. So when it sees a reference to an internal linkage function in a.c, it ignores any definitions of that function except the one in a.c.
Thanks,
Sira