provide a weak print char impl #674
@ -1 +1,3 @@
|
||||
add_subdirectory(gpio)
|
||||
|
||||
target_sources(${LIB_FSFW_NAME} PRIVATE printChar.c)
|
10
src/fsfw_hal/common/printChar.c
Normal file
10
src/fsfw_hal/common/printChar.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
void __attribute__((weak)) printChar(const char* character, bool errStream) {
|
||||
|
||||
if (errStream) {
|
||||
fprintf(stderr, "%c", *character);
|
||||
} else {
|
||||
printf("%c", *character);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user
Does not build with MSVC https://godbolt.org/z/s8hav4sdn
There seems to be solution for MSVC https://stackoverflow.com/questions/2290587/gcc-style-weak-linking-in-visual-studio
Wow, this looks.. interesting. Yet another MS specific solution
The solution above is for an extern const char*.
Actually, https://docs.microsoft.com/en-us/cpp/cpp/selectany?view=msvc-170 might work as well. I can't really test this as MSVC does not compile anyway, so I suggest support for this is added in a seprate PR.