主要内容

coder.SimulinkCoderBuildHooks Class

R2026b

Namespace: coder

Interface class for Simulink Coder build hooks

Since R2026b

Description

The coder.SimulinkCoderBuildHooks class provides an interface with overridable methods corresponding to Simulink® Coder™ build hook points.

To create a custom build hook class, derive your class from coder.SimulinkCoderBuildHooks and override the methods that you want to customize. Methods that you do not override default to empty implementations.

To trigger the build hooks, place your custom class definition in the MATLAB® path, then register your hooks to your target hardware using the target API. For an example, see Customize Build Process for Target Hardware Using Target Framework.

Methods

expand all

Examples

collapse all

Implement a subclass MyTargetSimulinkCoderBuildHook of coder.SimulinkCoderBuildHooks that overrides all the methods of the interface class. Define the overriding methods to print to console at each step of the build process.

classdef MyTargetSimulinkCoderBuildHook < coder.SimulinkCoderBuildHooks
    methods
        function entry(this, context)
            disp("entry build hook was called");
        end
        function beforeTLC(this, context)
            disp("beforeTLC build hook was called")
        end
        function afterTLC(this, context)
            disp("afterTLC build hook was called")
        end
        function afterCodeGeneration(this, context)
            disp("afterCodeGeneration build hook was called")
        end
        function afterMake(this, context)
            disp("afterMake build hook was called")
        end
    end
end

Place the class definition in the MATLAB path.

Version History

Introduced in R2026b