SPRUI04F july 2015 – april 2023
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++.
Example8-1 illustrates a C++ function called main, which calls an assembly language function called asmfunc, Example8-2. The asmfunc function takes its single argument, adds it to the C++ global variable called gvar, and returns the result.