logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

FFI::C::Union - Union data instance for FFI

Author

       Graham Ollis <plicease@cpan.org>

Constructor

new
        FFI::C::UnionDef->new( class => 'User::Union::Class', ... );
        my $instance = User::Union::Class->new;

       Creates a new instance of the "union".

Description

       This class represents an instance of a C "union".  This class can be created using "new" on the generated
       class, if that was specified for the FFI::C::UnionDef, or by using the "create" method on
       FFI::C::UnionDef.

       For each member defined in the FFI::C::UnionDef there is an accessor for the FFI::C::Union instance.

Name

       FFI::C::Union - Union data instance for FFI

See Also

       FFI::C
       FFI::C::Array
       FFI::C::ArrayDef
       FFI::C::Def
       FFI::C::File
       FFI::C::PosixFile
       FFI::C::Struct
       FFI::C::StructDef
       FFI::C::Union
       FFI::C::UnionDef
       FFI::C::Util
       FFI::Platypus::Record

Synopsis

        use FFI::C::UnionDef;

        my $def = FFI::C::UnionDef->new(
          name => 'anyint_t',
          class => 'AnyInt',
          members => [
            u8  => 'uint8',
            u16 => 'uint16',
            u32 => 'uint32',
          ],
        );

        my $int = AnyInt->new({ u8 => 42 });
        printf "0x%x\n", $int->u32;   # 0x2a on Intel

Version

       version 0.15

See Also