NAME
ExtUtils::Typemaps::IntObj - Typemap for storing objects as a string reference
VERSION
version 0.002
SYNOPSIS
In typemap
Foo::Bar T_INTOBJ
In your XS:
typedef handle_t Foo__Bar;
MODULE = Foo::Bar PACKAGE = Foo::Bar PREFIX = foobar_
Foo::Bar foobar_new(SV* class, int argument)
int foobar_baz(Foo::Bar self)
DESCRIPTION
ExtUtils::Typemaps::IntObj
is a typemap bundle that stores two typemaps: T_INTOBJ
and T_INTREF
.
T_INTOBJ
is a typemap for an XS object those state is a single immutable integer (e.g. some constant or handle). It stores the handle as a reference to an integer.
T_INTREF
is much the same as T_INTOBJ
but doesn't bless the reference.
INCLUSION
To use this typemap template you need to include it into your local typemap. The easiest way to do that is to use the typemap script in App::typemap. E.g.
typemap --merge ExtUtils::Typemaps::IntObj
If you author using Dist::Zilla
you can use Dist::Zilla::Plugin::Typemap instead.
Alternatively, you can include it at runtime by adding the following to your XS file:
INCLUDE_COMMAND: $^X -MExtUtils::Typemaps::Cmd -e "print embeddable_typemap('IntObj')"
That does require adding a build time dependency on this module.
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.