SPVM::Document::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.
The following is an example of a resource.
SPVM/Resource/MyResource.config
my $config = SPVM::Builder::Config->new_gnu99(file => __FILE__); 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
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 the use_resource method in the SPVM::Builder::Config class.
SPVM/MyClass.config
my $config = SPVM::Builder::Config->new_gnu99(file => __FILE__); $config->use_resource("Resource::MyResource"); $config;
SPVM/MyClass.c
#include "myresource.h"
See Resource::Zlib as an example of resources.
A distribution for a resource can be generated by the spvmdist command with the --resource option.
--resource
# C spvmdist --resource Resource::Foo # C++ spvmdist --resource --native c++ Resource::Foo
Resource Modules
Copyright (c) 2023 Yuki Kimoto
MIT License
To install SPVM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM
CPAN shell
perl -MCPAN -e shell install SPVM
For more information on module installation, please visit the detailed CPAN module installation guide.