Skip to content

picolib: stdio.h is missing extern "C" #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nolange opened this issue Nov 5, 2024 · 1 comment
Closed

picolib: stdio.h is missing extern "C" #558

nolange opened this issue Nov 5, 2024 · 1 comment

Comments

@nolange
Copy link

nolange commented Nov 5, 2024

This should be fixed since 1.8.7: picolibc/picolibc@c4b55b0

including stdio.h or cstdio will result in subtle to obvious breakage:

#include <stdio.h>

#ifdef FDEV_SETUP_STREAM

namespace {

int sample_putc(char c, FILE *file)
{
	(void) file;		/* Not used in this function */
	// __uart_putc(c);		/* Defined by underlying system */
	return c;
}

int sample_getc(FILE *file)
{
	unsigned char c = '\0';
	(void) file;		/* Not used in this function */
	// c = __uart_getc();	/* Defined by underlying system */
	return c;
}
FILE __stdio = FDEV_SETUP_STREAM(sample_putc,
					sample_getc,
					NULL,
					_FDEV_SETUP_RW);

} // namespace
extern "C" {
FILE *const stdin = &__stdio; __strong_reference(stdin, stdout); __strong_reference(stdin, stderr);
}

#endif // FDEV_SETUP_STREAM
@voltur01
Copy link
Contributor

voltur01 commented Nov 5, 2024

Hi, this fix should be available in the builds from the main branch now or you can rebuild llvm-19 branch with updated picolibc revision in https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/blob/llvm-19/versions.json

@voltur01 voltur01 closed this as completed Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants