Skip to content

extern C inside header file #10

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

Merged
merged 2 commits into from
Aug 14, 2015
Merged

Conversation

joycepg
Copy link
Contributor

@joycepg joycepg commented Aug 13, 2015

C++ compilers require that C functions are declared inside an extern "C" { } scope. This stops the compiler mangling the names, which would cause link errors. This pull request adds those into the header file, conditionally if __cplusplus is defined. All C++ compilers do define this symbol when they are compiling C++.

C functions need to be included within extern "C" { } to avoid the compiler mangling the names.
__cplusplus is always defined by C++ compilers.
wrap header file in extern C scope
@review-ninja
Copy link

ReviewNinja

@rijnb
Copy link
Member

rijnb commented Aug 14, 2015

Good point.

rijnb added a commit that referenced this pull request Aug 14, 2015
extern C inside header file
@rijnb rijnb merged commit cea07d3 into mapcode-foundation:master Aug 14, 2015
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

Successfully merging this pull request may close these issues.

3 participants