agbabi
agbabi copied to clipboard
"#undef errno" breaks platforms with non-standard errno definitions
For example, picolibc is compiled by default with thread-local storage enabled; while thread-local storage is of dubious usefulness for most GBA developers (Wonderful currently enables it to avoid building a separate world of packages like libstdc++
for the GBA alone), it makes the library less portable.
Is there an errno
API that could be used? Only reason it is used is to maintain POSIX API compliance
Yes. It's in errno.h
- including errno.h
alone should do the trick. As per the C11 standard's final draft:
[...] errno, which expands to a modifiable lvalue that has type int and thread local storage duration, the value of which is set to a positive error number by several library functions.