function [b, errstr, errid] = isslhdlcinstalled
%ISFDHDLCINSTALLED   Returns true if HDL Coder is installed.

%   Copyright 2006-2012 The MathWorks, Inc.

% Make it persistent so it's set only for the first use of simulink. 
% This helps improve the speed.
persistent slhdlinstalled;

% g2639810, added check for Simulink Online prewarm
if isempty(slhdlinstalled) || strcmp(getenv("PREWARM_SIMULINK"), 'true')
    slhdlinstalled = dig.isProductInstalled( 'HDL Coder' );
end

b = slhdlinstalled;

if b
    errstr = '';
    errid  = '';
else
    errstr = sprintf('%s\n%s', 'HDL Coder is not available.', ...
        'Make sure that it is installed and that a license is available.');
    errid  = 'noHDLCoder';
end
end
