Name

SPVM::Builder::LinkInfo - Link Information

Description

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

Usage

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

Fields

config

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

Gets and sets the config field.

This field is a SPVM::Builder::Config object used to link the object files.

output_file

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

Gets and sets the output_file field.

This field is 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.

This field is 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 with "Fields".

Default Field Values:

If a field is not defined, the field is set to the following default value.

Instance Methods

my $link_command = $link_info->create_link_command;

Creates a link command, and returns it. The return value is an array reference.

The following one is an example of the return value.

[qw(cc -o dylib.so foo.o bar.o -shared -O2 -Llibdir -lz)]
my $link_command_args = $link_info->create_link_command_args;

Creates the parts of the arguments of the link command from the information of the "config" field, and returns it. The return value is an array reference.

The -o option and the object file names are not contained.

The following one is an example of the return value.

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

to_cmd

my $link_command_string = $link_info->to_cmd;

Calls the create_link_command method and joins all elements of the returned array reference with a space, and returns it.

The following one is an example of the return value.

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

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License