Main Content

coder.ExternalDependency.isSupportedContext

Class: coder.ExternalDependency
Namespace: coder

Determine if build context supports external dependency

Syntax

tf = coder.ExternalDependency.isSupportedContext(bldcfg)

Description

tf = coder.ExternalDependency.isSupportedContext(bldcfg) returns if you can use the external dependency in the build context, bldcfg.

If you cannot use the external dependency in the current build context, display an error message and stop code generation. The error message must describe why you cannot use the external dependency in this build context. If the method returns false (0), the code generator uses a default error message. The default error message uses the name returned by the getDescriptiveName method of the coder.ExternalDependency class.

You must implement this method in a subclass of coder.ExternalDependency.

Input Arguments

expand all

Build context during code generation, specified as a coder.BuildConfig object. Use coder.BuildConfig methods to get information about the build context.

Output Arguments

expand all

Whether the build context supports the external dependency, returned as either true (1) or false (0).

Data Types: logical

Examples

expand all

This method returns true(1) if the code generation target is a MATLAB® host target. Otherwise, the method reports an error and stops code generation.

Write isSupportedContext method.

function tf = isSupportedContext(ctx)
    if  ctx.isMatlabHostTarget()
        tf = true;
    else
        error('adder library not available for this target');
    end
end

More About

expand all

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2013b