Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Tie::Array::Pointer 0.000059

    Download button

    No screenshots available
    Downloads: 219  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    John BEPPU | More programs
    Perl Artistic License / FREE
    February 16th, 2010, 01:31 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Tie::Array::Pointer description

    Ties a Perl array to a C pointer

    Tie::Array::Pointer is a Perl module that ties a Perl array to a C pointer. This makes it possible for Perl code and C code to share simple integer arrays.

    Options

    When you tie an array to Tie::Array::Pointer, you need to pass it a hashref that tells it how big the array is and what the simple integer type each of its elements is.

    length

     (required) :: The number of elements in the array.
    type

     (required) :: This is a very small subset of pack types, which defines whether the array contains 8 bit, 16 bit, or 32 bit integers. The valid values for this option are:

     c signed char 8 bit
     C unsigned char 8 bit
     s signed short 16 bit
     S unsigned short 16 bit
     l signed long 32 bit
     L unsigned long 32 bit


    address

     (optional) :: If you specify a memory address using this option, the act of tie'ing (tying?) will not allocate any memory. Instead, we'll trust that you know what you're doing and that the system will allow reads and writes to happen to this address.

    SYNOPSIS

    Tie to @buffer; allocate 256 * 4 bytes for me:

     use Tie::Array::Pointer;
     my @buffer;
     tie @buffer, 'Tie::Array::Pointer', {
     length => 256,
     type => 'L',
     };

    Tie to @buffer; use memory address I've provided:

     tie @buffer, 'Tie::Array::Pointer', {
     length => 320 * 200,
     type => 'c',
     address => 0x000a0000,
     };

    Get the memory address of the C array.

     my $addr = tied(@buffer)->address();



    Product's homepage

    Requirements:

    · Perl

    Limitations:

    · Don't treat arrays that are tied to this package as normal Perl arrays. When you tie arrays to this package, they really take on the characteristics of a C array. They should therefore be treated with the same carefulness that a C array would.

    · In future versions of this module, some of these limitations may be lifted, but don't hold your breath.

      


    TAGS:

    Perl array | tie array | C pointer | Perl | array | tie

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM