Name
SPVM::Builder::LibInfo - Library Information for A Linker
Description
The SPVM::Builder::LibInfo class has methods to manipulate library information for a linker.
Usage
my $lib_info = SPVM::Builder::LibInfo->new(%fields);
my $lib_ldflags = $lib_info->create_ldflags;
Fields
config
my $config = $lib_info->config;
$lib_info->config($config);
Gets and sets the config
field, an SPVM::Builder::Config object.
name
my $name = $lib_info->name;
$lib_info->name($name);
Gets and sets the name
field, 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, the absolute path of the library file such as /path/libz.so
, /path/libpng.a
.
is_static
my $is_static = $lib_info->is_static;
$lib_info->is_static($is_static);
Gets and sets the is_static
field. If this field is a true value, this library is linked statically. Otherwise, is linked dynamically.
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 absolute path "file". Otherwise, is linked by the relative path from library search path.
Class Methods
new
my $lib_info = SPVM::Builder::LibInfo->new(%fields);
Creates a new SPVM::Builder::LibInfo object given fields.
The config
field must be defined.
Field Default Values:
All Fields
undef
Exceptions:
The "config" field must be defined.
Instance Methods
create_ldflags
my $lib_ldflags = $lib_info->create_ldflags;
Creates an array reference of the library part of the linker flags given to the linker ld, and returns it.
Return Value Examples:
["-lfoo", "-Wl,-Bstatic -lfoo -Wl,-Bdynamic", "/path/foo.so", "/path/foo.a"]
to_string
my $lib_name = $lib_info->to_string;
Returns "name" field.
Operators
Overloads the following operators.
bool
my $bool = !!$lib_info;
Always true.
stringify
my $lib_name = "$lib_info";
Alias for "to_string" method.
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License