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