External symbols
Specify symbol names that are not defined in code
Since R2023b
Description
Specify names of symbols (variables and functions) that are not defined in the code added to the project and must be treated as externally defined. This option applies to dynamic testing only.
Set Option
You can set this option in the Polyspace® Platform user interface using one of these methods:
Enter the undefined symbol name explicitly:
Open your project configuration.
On the Build tab, select the Target & Compiler node and enter undefined symbol names for the option External Symbols.
Mark an undefined symbol name as external:
After parsing the source code in a project, on the toolstrip, select Code Explorer.
On the Code pane, right-click the undefined symbol name below the Undefined Symbols node and select Mark as External.
To mark all undefined symbols as external, right-click the Undefined Symbols node and select Mark All as External.
When you mark a symbol as external, the name of the symbol is automatically entered for the option External Symbols in the project configuration.
Why Use This Option
After you parse the code in a Polyspace Platform project, you see a list of undefined symbols. A symbol is shown as undefined if the symbol definition cannot be found directly in the sources or includes in the project. You can then stub functions or variables as needed, and build the project. When you build a project, there is an initial check for any remaining undefined symbol that has not been stubbed. If an undefined symbol is found, the build process exits with an error.
However, for a subset of undefined symbols, the symbol definition might be available only at build time. For instance, the symbol might be defined in a dynamically linked library. For these cases, you can mark the symbol as external to bypass the initial check for undefined symbols and proceed to build the project. This is similar to using the extern keyword in a declaration in a C file to avoid errors at compile time.
Note that if the symbol definition is not available at build time, you will still get a build error.
Settings
Click the Add empty row button
to enter a new symbol name, or click the Add/edit multiple rows button
to enter multiple symbols in the Add/edit multiple
rows dialog box.
Note that for undefined functions, you have to enter the full function signature, for instance:
func(int32_t, int32_t)
Command-Line Information
The command-line workflow for setting this option depends on your workflow.
If you build your source and tests using a Polyspace Platform Project — Once you set this option in the project using the Polyspace Platform user interface, you cannot override or modify this option using the
polyspace-testcommand.If you build your sources and xUnit tests using your own toolchain — You might be able to provide definition of external symbols directly to your compiler as part of your build command. Consult the documentation of your compiler.
Version History
Introduced in R2023b