3.6 Rules for calling between C, C++, and assembly language

Some general rules apply when calling between C, C++, and assembly language.

  • Use C calling conventions.
  • C header files must be wrapped in extern "C" directives before they are included from C++.
  • In C++, nonmember functions can be declared as extern "C" to specify that they have C linkage. Having C linkage means that the symbol defining the function is not mangled. You can use C linkage to implement a function in one language and call it from another.

    Note

    Functions that are declared extern "C" cannot be overloaded.
  • Assembly language modules must conform to the appropriate AAPCS standard for the memory model used by the application.
Related concepts
3.5 Mixed-language programming
3.7 Rules for calling C++ functions from C and assembly language
Related information
The compiler
Non-ConfidentialPDF file icon PDF versionARM DUI0471K
Copyright © 2010-2014 ARM. All rights reserved.