link_shared Subroutine

public subroutine link_shared(self, output, args, log_file, stat, dry_run)

Link a shared library

Type Bound

compiler_t

Arguments

Type IntentOptional Attributes Name
class(compiler_t), intent(in) :: self

Instance of the compiler object

character(len=*), intent(in) :: output

Output file of shared library object

character(len=*), intent(in) :: args

Arguments for the compiler

character(len=*), intent(in) :: log_file

Compiler output log file

integer, intent(out) :: stat

Status flag

logical, intent(in), optional :: dry_run

Optional mocking


Variables

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: command
logical, public :: mock
character(len=:), public, allocatable :: shared_flag

Source Code

subroutine link_shared(self, output, args, log_file, stat, dry_run)
    !> Instance of the compiler object
    class(compiler_t), intent(in) :: self
    !> Output file of shared library object
    character(len=*), intent(in) :: output
    !> Arguments for the compiler
    character(len=*), intent(in) :: args
    !> Compiler output log file
    character(len=*), intent(in) :: log_file
    !> Status flag
    integer, intent(out) :: stat
    !> Optional mocking
    logical, optional, intent(in) :: dry_run

    character(len=:), allocatable :: command
    logical :: mock
    character(len=:), allocatable :: shared_flag

    mock = .false.
    if (present(dry_run)) mock = dry_run

    shared_flag = get_shared_flag(self)

    command = self%fc // " " // shared_flag // " " // args // " -o " // output

    if (.not.mock) &
        call run(command, echo=self%echo, verbose=self%verbose, redirect=log_file, exitstat=stat)

end subroutine link_shared