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




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.

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:


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 Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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.

collapse all

File name, specified as a character vector.

Example: 'myFile.c'

Function name, specified as a character vector.

Example: 'myFunc'

Folder name, specified as a character vector.

All files in the folder are ignored for coverage.

Example: 'C:\Libraries\'

Introduced in R2015a

Was this topic helpful?