POSIX arch: Fix C++ main() linkage issue
To be able to define main() in C++ code we need to have its prototype defined somewhere visibly. Otherwise name mangling will prevent the linker from finding it. Zephyr assumes a void main(void) prototype and therefore this will be the prototype after renaming: void zephyr_app_main(void); Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
This commit is contained in:
parent
2802fa4e6d
commit
66bdb76e7c
1 changed files with 14 additions and 0 deletions
|
@ -44,6 +44,20 @@
|
|||
#define main(...) zephyr_app_main(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* To be able to define main() in C++ code we need to have its prototype
|
||||
* defined somewhere visibly. Otherwise name mangling will prevent the linker
|
||||
* from finding it. Zephyr assumes a void main(void) prototype and therefore
|
||||
* this will be the prototype after renaming:
|
||||
*/
|
||||
void zephyr_app_main(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POSIX_API
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue