EasyManuals Logo

Texas Instruments TMS320 User Manual

Texas Instruments TMS320
288 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #59 background imageLoading...
Page #59 background image
Using C++ with DSP/BIOS
Program Generation 2-29
Example 2-4. Declaring Functions in an Extern C Block
This allows you to refer to the functions within the configuration. For example,
if you had an SWI object which should run function1() every time that the SWI
posts, you would use function1 for 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 the configuration. 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.
Default parameters is a C++ feature that is not available for functions called
from the configuration. C++ allows you to specify default values for formal
parameters within the function declaration. However, a function called from
the configuration must provide parameter values. If no values are specified,
the actual parameter values are undefined.
2.9.3 Calling Class Methods from the Configuration
Often, the function that you want to reference within the configuration is the
member function of a class object. It is not possible to call these member
functions directly from the configuration, 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.
A wrapper function for a class method is shown in Example 2-6.
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
}

Table of Contents

Other manuals for Texas Instruments TMS320

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TMS320 and is the answer not in the manual?

Texas Instruments TMS320 Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS320
CategoryComputer Hardware
LanguageEnglish

Related product manuals