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

No 'extern "C"' support in headers #509

Open
dosadi opened this issue Aug 5, 2020 · 2 comments
Open

No 'extern "C"' support in headers #509

dosadi opened this issue Aug 5, 2020 · 2 comments

Comments

@dosadi
Copy link

dosadi commented Aug 5, 2020

Hi,

I am attempting to make use of picoTCP in a C++ environment, and I just got eveything to build and noticed that I am getting symbols not being found due to name mangling issues. Normally you would fix this problem to make the C code in picoTCP useable in a C++ environment by enclosing the relevant forward declarations in the header files like this:

extern "C" {
... body of header file ...
} /* extern "C" */

I am going to have to make this type of change myself all through picoTCP's header files to get everything to build, but I thought I'd also open an issue here on GitHub - I couldn't find much about this on a Google search or here in the issues on GH.

@frederikvs
Copy link
Contributor

Hi @dosadi

In case picoTCP decides not to make this change, or you don't want to wait for them, there's a slightly simpler solution for you : rather than going around all picoTCP headers to put in that extern, you could just use

extern "C" {
#include "foo.h"
#include "bar.h"
} /* extern "C" */

in your c++ files, wherever you're importing a C library.

Works the same way, but may be less work for you :-)

@dosadi
Copy link
Author

dosadi commented Aug 5, 2020

Thanks, that worked! I've never seen that before.

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