Name

SPVM::Builder::LibInfo - Library Information

Description

The SPVM::Builder::LibInfo class has methods to manipulate library information.

Usage

my $lib_info = SPVM::Builder::LibInfo->new(%fields);
my $lib_arg = $lib_info->to_arg;

Fields

name

my $name = $lib_info->name;
$lib_info->name($name);

Gets and sets the name field.

This field is a library name.

Examples:

$lib_info->name('z');

$lib_info->name('png');

file

my $file = $lib_info->file;
$lib_info->file($file);

Gets and sets the file field.

This field is the absolute path of the library file like /path/libz.so, /path/libpng.a.

is_class_method

my $is_class_method = $lib_info->is_class_method;
$lib_info->is_class_method($is_class_method);

Gets and sets the is_class_method field.

If this field is a true value, a static library is linked.

is_abs

my $is_abs = $lib_info->is_abs;
$lib_info->is_abs($is_abs);

Gets and sets the is_abs field.

If this field is a true value, the library is linked by the library name like -lfoo.

Otherwise the library is linked by the absolute path of the library like /path/libfoo.so.

static_option_cb

my $static_option_cb = $lib_info->static_option_cb;
$lib_info->static_option_cb($static_option_cb);

Gets and sets the static_option_cb field.

This field is the callback to create a linker option to link a static library.

Class Methods

new

my $lib_info = SPVM::Builder::LibInfo->new(%fields);

Creates a SPVM::Builder::LibInfo object with "Fields".

Default Field Values:

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

Instance Methods

to_arg

my $link_command_arg = $lib_info->to_arg;

Creates an argument of the link command from the "is_abs" field and "is_class_method" field, and returns it.

The following ones are examples of the return value.

-lfoo
-Wl,-Bstatic -lfoo -Wl,-Bdynamic
/path/foo.so
/path/foo.a

to_string

my $lib_name = $lib_info->to_string;

Returns the "name" field.

Operators

Overloads the following operators.

bool

my $bool = !!$lib_info;

Always true.

stringify

my $lib_name = "$lib_info";

Alias for the "to_string" method.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License