github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/lib/picolibc-stdio.c (about) 1 // This file is included in the picolibc build. 2 // It makes stdio functions available to the C library. 3 4 #include <stdio.h> 5 #include <sys/cdefs.h> 6 7 // Defined in the runtime package. Writes to the default console (usually, the 8 // first UART or an USB-CDC device). 9 int runtime_putchar(char, FILE*); 10 11 // Define stdin, stdout, and stderr as a single object. 12 // This object must not reside in ROM. 13 static FILE __stdio = FDEV_SETUP_STREAM(runtime_putchar, NULL, NULL, _FDEV_SETUP_WRITE); 14 15 // Define the underlying structs for stdin, stdout, and stderr. 16 FILE *const stdin = &__stdio; 17 __strong_reference(stdin, stdout); 18 __strong_reference(stdin, stderr);