The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Builder::API - Builder APIs

Description

The SPVM::Builder::API class has the public methods to build SPVM native classes and SPVM precompilation classes.

Usage

  my $builder = SPVM::Builder::API->new(
    build_dir => '.spvm_build',
  );
  
  $builder->build_dynamic_lib_dist_precompile('MyClass');
  
  $builder->build_dynamic_lib_dist_native('MyClass');

Class Methods

new

  my $builder = SPVM::Builder::API->new(%options);

Creates a new SPVM::Builder::API object, and returns it.

Options:

  • build_dir

    A build directory.

Instance Methods

build_dynamic_lib_dist_precompile

  $builder->build_dynamic_lib_dist_precompile($class_name)
  $builder->build_dynamic_lib_dist_precompile($class_name, $options)

Generates a dynamic library for a native class given by the class name $class_name, and copies it into the blib/lib directory.

A native class must have at least one method with the native attribute.

Options:

$options is a hash reference. This is optional.

  • force

    If this option is a true value, the compilation and link are forced.

build_dynamic_lib_dist_native

  $builder->build_dynamic_lib_dist_native($class_name)
  $builder->build_dynamic_lib_dist_native($class_name, $options)

Generates a dynamic library for a precompilation class $class_name that has native methods, and copies it into the blib/lib directory.

A precompilation class must have at least one method with the precompile attribute.

Options:

$options is a hash reference. This is optional.

  • force

    If this option is a true value, the compilation and link are forced.