Main Content

slcovmex

Build coverage-compatible MEX-function from C/C++ code

Description

slcovmex(sourceFile1,...,sourceFileN) compiles level 2 C/C++ MEX S-Function to work with coverage.

slcovmex(sourceFile1,...,sourceFileN,-sldv) compiles level 2 C/C++ MEX S-Function to work with coverage, and with support enabled for Simulink® Design Verifier™.

slcovmex(sourceFile1,...,sourceFileN,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

slcovmex(argumentSet1,...,argumentSetN) combines several mex function calls, each with one set of arguments.

Input Arguments

collapse all

Comma-separated source file names with each name specified as a character vector or string.

If the files are not in the current folder, the file names must include the full path or relative path. Use pwd to find the current folder and cd to change the current folder.

Example: 'file1.c', 'file1.c','file2.c'

Comma-separated mex argument sets, with each set specified as a cell array.

If you invoke mex multiple times, you can invoke slcovmex once and pass the arguments for each mex invocation as a cell array of character vectors.

For example, if you use the following sequence of mex commands:

 mex -c file1.c
 mex -c file2.c
 mex file1.o file2.o -output sfcnOutput
You can replace the sequence with one slcovmex invocation:

slcovmex({'-c','file1.c'},{'-c','file2.c'},{'file1.o','file2.o',
'-output','sfcnOutput'})

Example: {'-c','file1.c'},{'-c','file2.c'},{'file1.o','file2.o','-output','sfcnOutput'}

Option to enable support for your compiled MEX-function in Simulink Design Verifier.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: You can use all the name-value pair arguments that are allowed for the mex function. In addition, you can use the following options that are specific to model coverage.

File name, specified as a character vector or string.

Example: 'myFile.c'

Function name, specified as a character vector or string.

Example: 'myFunc'

Folder name, specified as a character vector or string.

All files in the folder are ignored for coverage.

Example: 'C:\Libraries\'

Version History

Introduced in R2015a