Name
SPVM::Resource::Coro - libcoro Resources
Description
Resource::Coro class in SPVM is a resource class for libcoro.
Usage
MyClass.config:
my $config = SPVM::Builder::Config->new_c99;
$config->use_resource('Resource::Coro');
$config->add_define(@{$config->get_resource('Resource::Coro')->config->defines});
$config;
MyClass.c:
#include "spvm_native.h"
#include "coro.h"
int32_t SPVM__MyClass__test(SPVM_ENV* env, SPVM_VALUE* stack) {
coro_context ctx;
return 0;
}
Original Product
Original Product Version
Use the code bundled in Coro 6.57 on CPAN.
Language
C language
Language Standard
C99
Header Files
coro.h
Source Files
coro.c
Compiler Flags
The compiler flags are automatically configured based on the OS and its environment to ensure the correct context switching mechanism (e.g., C, setjmp/longjmp, or C).
Typical flags include:
-DCORO_UCONTEXT(used whenucontext.his available)-DCORO_SJLJ(used forsetjmp/longjmpbased switching)-DCORO_ASM(used for assembly-based switching)-DCORO_PTHREAD(used when C are required)-D_FORTIFY_SOURCE=0(often required forsetjmp/longjmpstability)
The actual flags applied are determined at build-time by detecting the target platform and specific system requirements (such as thread support and stack alignment).
Flags starting with -D can be retrieved from defines field without the -D prefix.
How to Create Resource
Donwload
mkdir -p .tmp
curl -L https://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/Coro-6.57.tar.gz | tar -xz -C .tmp
Extracting Source Files
cp .tmp/Coro-6.57/Coro/libcoro/coro.h lib/SPVM/Resource/Coro.native/include/
Extracting Header Files
cp .tmp/Coro-6.57/Coro/libcoro/coro.c lib/SPVM/Resource/Coro.native/src/
Apply Patch
patch -p1 < coro_fix.patch
Repository
Author
Yuki Kimoto kimoto.yuki@gmail.com
Copyright & License
Copyright (c) 2026 Yuki Kimoto
MIT License