Scroll to navigation

Dist::Build::XS::WriteConstants(3pm) User Contributed Perl Documentation Dist::Build::XS::WriteConstants(3pm)

NAME

Dist::Build::XS::WriteConstants - Dist::Build extension integrating ExtUtils::Constant

VERSION

version 0.016

SYNOPSIS

 load_module('Dist::Build::XS');
 load_module('Dist::Build::XS::WriteConstants');
 add_xs(
     module          => 'Foo::Bar',
         write_constants => {
                NAMES => [ qw/FOO BAR BAZ/ ],
         },
 );

DESCRIPTION

This module is an extension of Dist::Build::XS, adding an additional argument to the "add_xs" function: "write_constants". This hash will take the same members as the "WriteConstants" function of ExtUtils::Constant, except that it will set sensible default values for the "NAME" (based on the module's name), "C_FILE" and "XS_FILE" (based on the XS file's directory and "CONST_BASENAME" defaulting to 'const') members so usually those will not need to be passed. So the above example is equivalent to

  {
    NAME    => 'Foo::Bar',
    NAMES   => [ 'FOO' ],
    C_FILE  => 'lib/Foo/const-c.inc',
    XS_FILE => 'lib/Foo/const-xs.inc',
  }

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2024-10-07 perl v5.38.2