Main Content


Class: coder.LAPACKCallback
Package: coder

Update build information for linking to a specific LAPACK library


coder.LAPACKCallback.updateBuildInfo(buildInfo, buildctx)


coder.LAPACKCallback.updateBuildInfo(buildInfo, buildctx) updates the build information object buildInfo with the information required for the build process to link to a specific LAPACK library.

coder.LAPACKCallback is an abstract class for defining a LAPACK callback class. A LAPACK callback class specifies the LAPACK library and LAPACKE header file to use for LAPACK calls in code generated from MATLAB® code. At code generation time, if you specify a LAPACK callback class, for certain linear algebra function calls, the code generator produces LAPACK calls in standalone code.

Input Arguments


Build information object. After code generation, this object contains standard project, build option, and dependency information. In the updateBuildInfo method, to add the information for linking to the LAPACK library, use build information methods.


coder.BuildConfig object. Use the coder.BuildConfig getStdLibInfo method to get the platform-specific file extension to use at link time.


expand all

This example shows how to write an updateBuildInfo method to update the build information object with the information required to link to a specific LAPACK library.

In a class that derives from coder.LAPACKCallback, write a method updateBuildInfo. Use this example LAPACK callback class as a template.

classdef useMyLAPACK < coder.LAPACKCallback
    methods (Static)
        function hn = getHeaderFilename()
            hn = 'mylapacke_custom.h';
        function updateBuildInfo(buildInfo, buildctx)
            libName = 'mylapack';
            libPath = fullfile(pwd,'lib');
            [~,linkLibExt] = buildctx.getStdLibInfo();
            buildInfo.addLinkObjects([libName linkLibExt], libPath, ...
                '', true, true);

Replace mylapack with the name of your LAPACK library. Modify the include and library paths as necessary.

To update the build information with the location of the header files, use the build information addIncludePaths method.

To access the platform-specific library extension, use the coder.BuildConfig getStdLibInfo method.

To update the build information with the name and location of your LAPACK library, use the build information addlinkObjects method.

If your compiler supports only complex data types that are represented as structures, include these lines.


You must specify the integer type that your LAPACK library uses. Not specifying this integer type can result in incorrect behaviors or crashes. Do one of the following:

  • Include these lines in the updateBuildInfo method.


  • Alternatively, you can directly specify the integer type that your LAPACK library uses. For example, if the integer type is long long, include this line in the updateBuildInfo method.

    buildInfo.addDefines('lapack_int=long long');