SLAU132Y September 2004 – June 2021
Functions defined in C++ that will be called from assembly should be defined as extern "C" in the C++ file. Functions defined in assembly that will be called from C++ must be prototyped as extern "C" in C++.
Section 7.7.2.1 illustrates a C++ function called main, which calls an assembly language function called asmfunc, Section 7.7.2.2. The asmfunc function takes its single argument, adds it to the C++ global variable called gvar, and returns the result.