function str = getSharedLibraryLinkerCommand(h,buildInfo,varargin)
%

%   Copyright 2014-2016 The MathWorks, Inc.

toolKey = 'Linker';
toolOptionKey = 'Shared Library Linker';  % option name is not same as tool name
if h.ToolchainInfo.BuildTools.isKey('C++ Compiler')
    % Override the linker if a C++ source file or module is present
    exts = h.getAllModules;
    compilerTool_cpp = h.getBuildTool( 'C++ Compiler' );
    CPPSRC_EXTS = compilerTool_cpp.getIOFileExtensions( 'input' );
    if any( ismember( exts, CPPSRC_EXTS ) )
        toolKey = { 'C++ Linker', toolKey };
        toolOptionKey = { 'C++ Shared Library Linker', toolOptionKey };
    end
end
outputFlagKey = 'OutputFlag';
str = h.formCommandFromPattern( buildInfo, 'BuildTool', toolKey, toolOptionKey, outputFlagKey, varargin{ : } );
end
