Skip to content

Commit 9cb9b9b

Browse files
Merge pull request #4718 from ARMmbed/g-weak-note
Toolchain: Add a note about weak functions and header files
2 parents 10a06a7 + eb4c223 commit 9cb9b9b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

platform/mbed_toolchain.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,15 @@
9494

9595
/** MBED_WEAK
9696
* Mark a function as being weak.
97+
*
98+
* @note
99+
* Functions should only be marked as weak in the source file. The header file
100+
* should contain a regular function declaration to insure the function is emitted.
101+
* A function marked weak will not be emitted if an alternative non-weak
102+
* implementation is defined.
97103
*
98104
* @note
99-
* weak functions are not friendly to making code re-usable, as they can only
105+
* Weak functions are not friendly to making code re-usable, as they can only
100106
* be overridden once (and if they are multiply overridden the linker will emit
101107
* no warning). You should not normally use weak symbols as part of the API to
102108
* re-usable modules.

0 commit comments

Comments
 (0)