prusa3d / MM-control-01

MMU 3-axis stepper control
GNU General Public License v3.0
92 stars 103 forks source link

select proper linkage for each 'inline' function #189

Open zavorka opened 3 years ago

zavorka commented 3 years ago

As the 'inline' designation is merely a hint for a compiler, an inline function might likely actually end up being compiled on its own, in which case, the linkage specifiers become significant. Therefore, one has to be prepared for such eventuality: you can either declare the function 'static' and have it be compiled in each translation unit separately, or redeclare it with 'extern' in one translation unit. Another option is to inline it forcefully with always_inline attribute. Either way, it has to be dealt with.

Note: the inline keyword behaves differently in C++ than in C99/C11.

Fixes #181, #185