| Contents | Index |
entry = registerCPPFunctionEntry(hTable, priority, numInputs, functionName, inputType, implementationName, outputType, headerFile, genCallback, genFileName, nameSpace)
Handle to a CRL table previously returned by hTable = RTW.TflTable.
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.
Positive integer specifying the number of input arguments.
String specifying the name of the function to be replaced. The name must match one of the functions supported for replacement:
Math Functions
| ||||
| abs | acos | acosh | asin | |
| asinh | atan | atan2 | atanh | |
| ceil | cos | cosh | exactrSqrt | |
| exp | fix | floor | frexp | |
| hypot | ldexp | ln | log | |
| log10 | max | min | mod/fmod | |
| pow | rem | round | rSqrt | |
| saturate | sign | sin | sincos | |
| sinh | sqrt | round | tanh | |
| Memory Utility Functions | ||||
| memcmp | memcpy | memset | memset2zero1 | |
| Nonfinite Support Utility Functions2 | ||||
| getInf | getMinusInf | getNaN | isInf3 | |
| 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. | ||||
String specifying the data type of the input arguments, for example, 'double'. (This function requires that all input arguments are of the same type.)
String specifying the name of your implementation. For example, if functionName is 'sqrt', implementationName can be 'sqrt' or a different name of your choosing.
String specifying the data type of the return argument, for example, 'double'.
String specifying the header file in which the implementation function is declared, for example, '<math.h>'.
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.
String specifying ''. (This argument is for use only by MathWorks developers.)
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.
Handle to the created CRL C++ function entry. Specifying the return argument in the registerCPPFunctionEntry function call is optional.
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:
All input arguments are of the same type.
All input argument names and the return argument name follow the default Simulink naming convention:
For input argument names, u1, u2, ..., un
For return argument, y1
Note When you register a CRL containing C++ function entries, you must specify the value {'C++'} for the LanguageConstraint property of the CRL registry entry. For more information, see Register Code Replacement Libraries. |
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');
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 |