Skip to Main Content Skip to Search
Product Documentation

registerCPPFunctionEntry - Create CRL C++ function entry based on specified parameters and register in CRL table

Syntax

entry = registerCPPFunctionEntry(hTable, priority, numInputs, functionName, inputType, implementationName, outputType, headerFile, genCallback, genFileName, nameSpace)

Input Arguments

hTable

Handle to a CRL table previously returned by hTable = RTW.TflTable.

priority

Positive integer specifying the function entry's search priority, 0-100, relative to other entries of the same function name and conceptual argument list within this table. Highest priority is 0, and lowest priority is 100. If the table provides two implementations for a function, the implementation with the higher priority will shadow the one with the lower priority.

numInputs

Positive integer specifying the number of input arguments.

functionName

String specifying the name of the function to be replaced. The name must match one of the functions supported for replacement:

Math Functions

absacosacoshasin
asinhatanatan2atanh
ceilcoscoshexactrSqrt
expfixfloorfrexp
hypotldexplnlog
log10maxminmod/fmod
powremroundrSqrt
saturatesignsinsincos
sinhsqrtroundtanh
Memory Utility Functions
memcmpmemcpymemsetmemset2zero1
Nonfinite Support Utility Functions2
getInfgetMinusInfgetNaNisInf3
isNaN3   
Notes:
1 Some target processors provide optimized memset functions for use when performing a memory set to zero. The CRL API supports replacing memset to zero functions with more efficient target-specific functions.
2 Replacement of nonfinite functions is supported for Simulink code generation (not for Stateflow or MATLAB Coder code generation).
3 Replacement of isInf and isNaN is supported only for complex floating-point inputs.

inputType

String specifying the data type of the input arguments, for example, 'double'. (This function requires that all input arguments are of the same type.)

implementationName

String specifying the name of your implementation. For example, if functionName is 'sqrt', implementationName can be 'sqrt' or a different name of your choosing.

outputType

String specifying the data type of the return argument, for example, 'double'.

headerFile

String specifying the header file in which the implementation function is declared, for example, '<math.h>'.

genCallback

String specifying '' or 'RTW.copyFileToBuildDir'. If you specify 'RTW.copyFileToBuildDir', and if this function entry is matched and used, the function RTW.copyFileToBuildDir will be called after code generation to copy additional header, source, or object files that you have specified for this function entry to the build directory. For more information, see Specify Build Information for Code Replacements in the Embedded Coder documentation.

genFileName

String specifying ''. (This argument is for use only by MathWorks developers.)

nameSpace

String specifying the C++ name space in which the implementation function is defined. If this function entry is matched, the software emits the name space in the generated function code (for example, std::sin(tfl_cpp_U.In1)). If you specify '', the software does not emit a name space designation in the generated code.

Output Arguments

Handle to the created CRL C++ function entry. Specifying the return argument in the registerCPPFunctionEntry function call is optional.

Description

The registerCPPFunctionEntry function provides a quick way to create and register a CRL C++ function entry. This function can be used only if your CRL C++ function entry meets the following conditions:

Examples

In the following example, the registerCPPFunctionEntry function is used to create a C++ function entry for sin in a CRL table.

hLib = RTW.TflTable;

hLib.registerCPPFunctionEntry(100, 1, 'sin', 'single', 'sin', ...
                              'single', 'cmath', '', '', 'std');

See Also

enableCPP | setNameSpace

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS