| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop |
| Contents | Index |
| Learn more about Real-Time Workshop |
addLinkObjects(buildinfo, linkobjs, paths, priority, precompiled, linkonly, groups)
All arguments except buildinfo , linkobjs, and paths are optional. If you specify an optional argument, you must specify all of the optional arguments preceding it.
Build information returned by RTW.BuildInfo.
A character array or cell array of character arrays that specifies the filenames of linkable objects to be added to the build information. The function adds the filenames that you specify in the function call to a vector that stores the object filenames in priority order. If you specify multiple objects that have the same priority (see priority below), the function adds them to the vector based on the order in which you specify the object filenames in the cell array.
The function removes duplicate link objects that
You specify as input
Already exist in the linkable object filename vector
Have a path that matches the path of a matching linkable object filename
A duplicate entry consists of an exact match of a path string and corresponding linkable object filename.
A character array or cell array of character arrays that specifies paths to the linkable objects. If you specify a character array, the path string applies to all linkable objects.
A numeric value or vector of numeric values that indicates the relative priority of each specified link object. Lower values have higher priority. The default priority is 1000.
The logical value true or false or a vector of logical values that indicates whether each specified link object is precompiled.
Specify true if the link object has been prebuilt for faster compiling and linking and exists in a specified location.
If precompiled is false (the default), the Real-Time Workshop build process creates the link object in the build directory.
This argument is ignored if linkonly equals true.
The logical value true or false or a vector of logical values that indicates whether each specified link object is to be used only for linking.
Specify true if the Real-Time Workshop build process should not build, nor generate rules in the makefile for building, the specified link object, but should include it when linking the final executable. For example, you can use this to incorporate link objects for which source files are not available. If linkonly is true, the value of precompiled is ignored.
If linkonly is false (the default), rules for building the link objects are added to the makefile. In this case, the value of precompiled determines which subsection of the added rules is expanded, START_PRECOMP_LIBRARIES (true) or START_EXPAND_LIBRARIES (false).
A character array or cell array of character arrays that groups specified link objects. You can use groups to
Document the use of specific link objects
Retrieve or apply groups of link objects
You can apply
A single group name to a linkable object
A single group name to multiple linkable objects
Multiple group name to collections of multiple linkable objects
| To... | Specify groups as a... |
|---|---|
| Apply one group name to all link objects | Character array. |
| Apply different group names to link objects | Cell array of character arrays such that the number of group names matches the number elements you specify for linkobjs. |
The default value of groups is {''}.
The addLinkObjects function adds specified link objects to the model's build information. The Real-Time Workshop software stores the link objects in a vector in relative priority order. If multiple objects have the same priority or you do not specify priorities, the function adds the objects to the vector based on the order in which you specify them.
In addition to the required buildinfo, linkobjs, and paths arguments, you can specify the optional arguments priority, precompiled, linkonly, and groups. You can specify paths and groups as a character array or a cell array of character arrays.
| If You Specify paths or groups as a... | The Function... |
|---|---|
| Character array | Applies the character array to all objects it adds to the build information. |
| Cell array of character arrays | Pairs each character array with a specified object. Thus, the length of the cell array must match the length of the cell array you specify for linkobjs. |
Similarly, you can specify priority, precompiled, and linkonly as a value or vector of values.
| If You Specify priority, precompiled, or linkonly as a... | The Function... |
|---|---|
| Value | Applies the value to all objects it adds to the build information. |
| Vector of values | Pairs each value with a specified object. Thus, the length of the vector must match the length of the cell array you specify for linkobjs. |
If you choose to specify an optional argument, you must specify all of the optional arguments preceding it. For example, to specify that all objects are precompiled using the precompiled argument, you must specify the priority argument that precedes precompiled. You could pass the default priority value 1000, as shown below.
addLinkObjects(myBuildInfo, 'test1', '/proj/lib/lib1', 1000, true);
Add the linkable objects libobj1 and libobj2 to build information myModelBuildInfo and set the priorities of the objects to 26 and 10, respectively. Since libobj2 is assigned the lower numeric priority value, and thus has the higher priority, the function orders the objects such that libobj2 precedes libobj1 in the vector.
myModelBuildInfo = RTW.BuildInfo;
addLinkObjects(myModelBuildInfo, {'libobj1' 'libobj2'},...
{'/proj/lib/lib1' '/proj/lib/lib2'}, [26 10]);Add the linkable objects libobj1 and libobj2 to build information myModelBuildInfo. Mark both objects as link-only. Since individual priorities are not specified, the function adds the objects to the vector in the order specified.
myModelBuildInfo = RTW.BuildInfo;
addLinkObjects(myModelBuildInfo, {'libobj1' 'libobj2'},...
{'/proj/lib/lib1' '/proj/lib/lib2'}, 1000,...
false, true);
Add the linkable objects libobj1 and libobj2 to build information myModelBuildInfo. Set the priorities of the objects to 26 and 10, respectively. Mark both objects as precompiled, and group them under the name MyTest.
myModelBuildInfo = RTW.BuildInfo;
addLinkObjects(myModelBuildInfo, {'libobj1' 'libobj2'},...
{'/proj/lib/lib1' '/proj/lib/lib2'}, [26 10],...
true, false, 'MyTest');
Programming a Post Code Generation Command
![]() | addLinkFlags | addNonBuildFiles | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |