User`s guide
Using C++ with DSP/BIOS
Program Generation 2-25
Example 2-4. Declaring Functions in an Extern C Block
This allows you to refer to the functions within the Configuration Tool
(preceded by an underscore, as with other C function names). For example,
if you had an SWI object which should run function1() every time that the SWI
posts, you would enter _function1 into the function property of that SWI
object.
Functions declared within the extern C block are not subject to name
mangling. Since function overloading is accomplished through name
mangling, function overloading has limitations for functions that are called
from within the Configuration Tool. Only one version of an overloaded
function can appear within the extern C block. The code in Example 2-5
would result in an error.
Example 2-5. Function Overloading Limitation
While you can use name overloading in your DSP/BIOS C++ applications,
only one version of the overloaded function can be called from the
Configuration Tool.
Default parameters is a C++ feature that is not available for functions called
from the Configuration Tool. C++ allows you to specify default values for
formal parameters within the function declaration. However, a function called
from the Configuration Tool must provide parameter values. If no values are
specified, the actual parameter values are undefined.
2.7.3 Calling Class Methods from the Configuration Tool
Often, the function that you want to reference within the Configuration Tool is
the member function of a class object. It is not possible to call these member
functions directly from the Configuration Tool, but it is possible to accomplish
the same action through wrapper functions. By writing a wrapper function
which accepts a class instance as a parameter, you can invoke the class
member function from within the wrapper.
extern "C" {
Void function1();
Int function2();
}
extern āCā {
Int addNums(Int x, Int y);
Int addNums(Int x, Int y, Int z); // error, only one version
// of addNums is allowed
}










