Manpage logo

SPVM::Document::Resource - Resource

Name  Resource  Resource Class  Resource User Class  Examples  Distribution  See Also  Copyright & License 

Name

SPVM::Document::Resource − Resource

Resource

A resource in SPVM is a native class that contains header files and source files writen by native languages such as the C language or C++. A resource must have its config file. A resource does not need to have a native class file.

Resource Class

The following is an example of a resource.

"SPVM/Resource/MyResource.config"

my $config = SPVM::Builder::Config−>new_gnu99;
$config−>is_resource(1);
my @source_files = ("myresource.c");
$config−>add_source_file(@source_files);
$config;

Native header files:

SPVM/Resource/MyResource.native/include/myresource.h

Native source files:

SPVM/Resource/MyResource.native/src/myresource.c

Resource User Class

A native class can include native header files of a resource and add the object files generated by native source files of a resource to the object files for the linker using SPVM::Builder::Config#use_resource.

"SPVM/MyClass.config"

my $config = SPVM::Builder::Config−>new_gnu99;
$config−>use_resource("Resource::MyResource");
$config;

"SPVM/MyClass.c"

#include "myresource.h"

Examples

See Resource::Zlib <https://github.com/yuki-kimoto/SPVM-Resource-Zlib> as an example of resources.

Distribution

A distribution for a resource can be generated by spvmdist command with "−−resource" option.

# C
spvmdist −−resource Resource::Foo
# C++
spvmdist −−resource −−native c++ Resource::Foo

See Also

Resource Modules <https://github.com/yuki-kimoto/SPVM/wiki/CPAN-Modules#resource-modules>

SPVM::Document

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License


Updated 2026-06-01 - jenkler.se | uex.se