Skip to content
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

Cannot use C++ on APPLICATION level initialization #25141

Closed
r2r0 opened this issue May 8, 2020 · 1 comment · Fixed by #25143
Closed

Cannot use C++ on APPLICATION level initialization #25141

r2r0 opened this issue May 8, 2020 · 1 comment · Fixed by #25143
Assignees
Labels
area: C++ bug The issue is a bug, or the PR is fixing a bug

Comments

@r2r0
Copy link
Member

r2r0 commented May 8, 2020

Describe the bug
Cannot use C++ in functions called at APPLICATION initialization level.
Because setup of C++ subsystem is performed after APPLICATION level initialization then C++ usage is limited to main & following threads.

To Reproduce
Steps to reproduce the behavior:

  1. Define static instance of class with non trivial constructor
  2. Use SYS_INIT macro to define function called at APPLICATION level
  3. Try to use C++ object in function defined in point 2
  4. Object is not properly constructed

Expected behavior
C++ sybsystem should be avialable at APPLICATION initialization level.
It would be great if the POST_KERNEL level will be also usable from C++ but maybe I am going too far.
If it is not possible (i.e. because of Zephyr design philosophy) then this limitation should be clearly mentioned in the documentation.

Impact
Annoyance.

Screenshots or console output

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: Zephyr SDK
  • Commit: 6789ecb

Additional context

@r2r0 r2r0 added the bug The issue is a bug, or the PR is fixing a bug label May 8, 2020
@pabigot
Copy link
Collaborator

pabigot commented May 8, 2020

I agree; I personally would like this to occur even earlier, but there was strong pushback at the suggestion that C++ might be used in drivers.

The documentation says it's supported for applications. It is ambiguous whether that includes initialization routines run at the application init level, but I think it's worth trying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: C++ bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants