SPVM::D...esource(3)

πŸ“¦ version 0.990125, in alpine 3.24

🌸 Name 🌸

okay so bestie, welcome to SPVM::Document::Resource β€” literally just Resource πŸ’–. This page comes from the User Contributed Perl Documentation, and the manual name/tag is SPVM::D...esource(3). Periodt.

✨ Resource ✨

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

πŸŽ€ Resource Class πŸŽ€

Here's a whole example of a resource, bestie. The config file is 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. It's giving build magic ✨.

The config file is SPVM/MyClass.config:

my $config = SPVM::Builder::Config->new_gnu99;

$config->use_resource("Resource::MyResource");

$config;

And SPVM/MyClass.c looks like this:

#include "myresource.h"

πŸ“ Examples πŸ“

Peep Resource::Zlib at https://github.com/yuki-kimoto/SPVM-Resource-Zlib β€” it's a real example of resources. Obsessed πŸ’….

🌈 Distribution 🌈

A distribution for a resource can be generated by the spvmdist command with the --resource option. Here's the vibe:

# C
spvmdist --resource Resource::Foo

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

πŸ’œ See Also πŸ’œ

Copyright (c) 2023 Yuki Kimoto

MIT License

okay that's the whole page, bestie! πŸ’… This one's from perl v5.42.2, dated 2026-02-03, and the manual tag is SPVM::D...esource(3) β€” slay 🫢.

πŸ“¦ where this page comes from