Name

SPVM::Builder::LinkInfo - Linker Information

Description

The SPVM::Builder::LinkInfo class has methods to manipulate linker information.

Usage

my $link_info = SPVM::Builder::LinkInfo->new(%fields);
my $link_command = $link_info->to_command;

Fields

config

my $config = $link_info->config;
$link_info->config($config);

Gets and sets the config field, an SPVM::Builder::Config object.

output_file

my $output_file = $link_info->output_file;
$link_info->output_file($output_file);

Gets and sets the output_file field, an output file.

object_files

my $object_files = $link_info->object_files;
$link_info->object_files($object_files);

Gets and sets the object_files field, an array reference of SPVM::Builder::ObjectFileInfo objects.

Class Methods

new

my $link_info = SPVM::Builder::LinkInfo->new(%fields);

Creates a new SPVM::Builder::LinkInfo object given "Fields".

Field Default Values:

Exceptions:

The "config" field must be defined.

Instance Methods

create_command

my $link_command = $link_info->create_command;

Creates an array reference of the link command, and returns it.

Return Value Examples:

[qw(cc -o dylib.so foo.o bar.o -shared -O2 -Llibdir -lz)]

create_ldflags

my $ldflags = $link_info->create_ldflags;

Creates an array reference of the linker options, and returns it.

The output file "output_file" and the object files "object_files" are not contained.

Return Value Examples:

[qw(-shared -O2 -Llibdir -lz)]

to_command

my $link_command_string = $link_info->to_command;

Joins all elements of the return value of "create_command" method with a space, and returns it.

Return Value Examples:

"cc -o dylib.so foo.o bar.o -shared -O2 -Llibdir -lz"

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License