Main Content

coder.LAPACKCallback.updateBuildInfo

Class: coder.LAPACKCallback
Namespace: coder

Update build information for linking to a specific LAPACK library

Syntax

coder.LAPACKCallback.updateBuildInfo(buildInfo, buildctx)

Description

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

expand all

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.

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

Examples

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';
        end
        function updateBuildInfo(buildInfo, buildctx)
            buildInfo.addIncludePaths(fullfile(pwd,'include'));
            libName = 'mylapack';
            libPath = fullfile(pwd,'lib');
            [~,linkLibExt] = buildctx.getStdLibInfo();
            buildInfo.addLinkObjects([libName linkLibExt], libPath, ...
                '', true, true);
            buildInfo.addDefines('HAVE_LAPACK_CONFIG_H');
            buildInfo.addDefines('LAPACK_COMPLEX_STRUCTURE');
            buildInfo.addDefines('LAPACK_ILP64'); 
        end
    end
end

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.

buildInfo.addDefines('HAVE_LAPACK_CONFIG_H');
buildInfo.addDefines('LAPACK_COMPLEX_STRUCTURE');

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.

    buildInfo.addDefines('HAVE_LAPACK_CONFIG_H');
    buildInfo.addDefines('LAPACK_ILP64');

  • 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');