SPRU514Z July 2001 – October 2023 SM320F28335-EP
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++.
Example7-1 illustrates a C++ function called main, which calls an assembly language function called asmfunc, Example7-2. The asmfunc function takes its single argument, adds it to the C++ global variable called gvar, and returns the result.