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;
$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
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"
See Resource::Zlib <https://github.com/yuki-kimoto/SPVM-Resource-Zlib> as an example of resources.
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
|
• |
Resource Modules <https://github.com/yuki-kimoto/SPVM/wiki/CPAN-Modules#resource-modules> | ||
|
• |
SPVM::Document |
Copyright (c) 2023 Yuki Kimoto
MIT License