Main Content


Class: coder.BLASCallback
Namespace: coder

Return the file name of CBLAS header file


headerName = coder.BLASCallback.getHeaderFilename()


headerName = coder.BLASCallback.getHeaderFilename() returns the name of the CBLAS header file that defines the C interface to a specific BLAS library.

coder.BLASCallback is an abstract class for defining a BLAS callback class. A BLAS callback class specifies the BLAS library and CBLAS header and data type information to use for BLAS calls in code generated from MATLAB® code. At code generation time, if you specify a BLAS callback class, for certain vector and matrix function calls, the code generator produces BLAS calls in standalone code.

getHeaderFilename is an abstract method. You must implement it in the definition of your callback class that derives from coder.BLASCallback. The code generator uses the CBLAS header file name returned by getHeaderFilename to produce a #include statement in the generated code.

Output Arguments

expand all

Character vector that specifies the name of the CBLAS header file that defines the C interface to a specific BLAS library.



To learn about attributes of methods, see Method Attributes.


expand all

This example shows how to write a getHeaderFilename method to return the name of the CBLAS header file.

In a class that derives from coder.BLASCallback, write a method getHeaderFilename that returns the name of the CBLAS header file as a character vector. This example is an implementation of the callback class mklcallback for integration with the Intel MKL BLAS library on a Windows® platform. In this class, getHeaderFilename returns 'mkl_cblas.h', which is the CBLAS header file for the Intel MKL BLAS library.

classdef mklcallback < coder.BLASCallback
    methods (Static)
        function updateBuildInfo(buildInfo, ~)
            libPath = fullfile(pwd,'mkl','WIN','lib','intel64');
            libPriority = '';
            libPreCompiled = true;
            libLinkOnly = true;
            libs = {'mkl_intel_ilp64.lib' 'mkl_intel_thread.lib' 'mkl_core.lib'};
            buildInfo.addLinkObjects(libs, libPath, libPriority, libPreCompiled, libLinkOnly);
            buildInfo.addLinkObjects('libiomp5md.lib',fullfile(matlabroot,'bin','win64'), ...
                libPriority, libPreCompiled, libLinkOnly);
        function headerName = getHeaderFilename()
            headerName = 'mkl_cblas.h';
        function intTypeName = getBLASIntTypeName()
            intTypeName = 'MKL_INT';

If you are using a different BLAS library, replace 'mkl_cblas.h' with the name of your CBLAS header file.

Version History

Introduced in R2018b