C PROGRAMMING

Linkage

Article by:
Date Published:
Last Modified:

The extern Keyword

The extern keyword is a linkage modifier that has different meanings in different contexts. In C++, when used it the form extern "C", it can be used to declare functions and variables which should have C linkage.

extern is not normally used in function definitions/declarations.

With variables, extern is normally used in-front of a variable declaration to declare that it is defined elsewhere (this will stop the compiler from trying to look for it, and save this for the linker step).

Inline functions have special rules on what the word extern means.


Authors

Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Tags

    comments powered by Disqus