Main > Programming > Libraries >

C::DynaLib::Struct 0.55

C::DynaLib::Struct 0.55

Sponsored Links

C::DynaLib::Struct 0.55 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.035 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 1211
Date added: 2006-07-05
Publisher: John Tobey

C::DynaLib::Struct 0.55 description

C::DynaLib::Struct is a tool for handling the C `struct data type.

SYNOPSIS

use C::DynaLib::Struct;

Define C::DynaLib::Struct(
$struct_tag,
$template0, @field_names0,
[$template1, @field_names1,]
... );

$rstruct = tie( $struct, $struct_tag [, @initializer_list] );
$value = $rstruct->my_field();
$rstruct->my_field( $new_value );

$pointer_to_struct = pack( p, $struct );
$struct = $new_struct; # assigns all fields at once

# after passing pointer-to-struct to a C function:
$rstruct->Unpack();
$returned_value = $rstruct->my_field();

When mixing Perl and C, the conversion of data types can be rather tedious and error-prone. This module provides an abstraction from Perls pack and unpack operators for using structures whose member data types and positions do not change.

Here are some examples of C code that deals with a struct. On the right are some possible Perl equivalents.

C Perl
- ----
typedef struct { use C::DynaLib::Struct;
int m_int; Define C::DynaLib::Struct(
double m_double; Foo,
char * m_string; i => [m_int],
} Foo; d => [m_double],
p => [m_string] );
# or, equivalently,
Define C::DynaLib::Struct(Foo,
idp, [qw(m_int m_double m_string)]);

Foo foo;
Foo *pfoo = &foo; $rfoo = tie ($foo, Foo);

i = pfoo->m_int; $i = $rfoo->m_int;

d = foo.m_double; $d = (tied $foo)->m_double;

pfoo->m_string = "hi"; $rfoo->m_string("hi");

Foo bar; tie ($bar, Foo);
bar = foo; $bar = $foo;

void do_foo(Foo *arg); use C::DynaLib;
$lib = new C::DynaLib("-lfoo");
$do_foo = $lib->DeclareSub("do_foo","","P");
# or you could write an XSUB.

do_foo(&foo); &$do_foo($foo);

returned_i = foo.m_int; $rfoo->Unpack();
$returned_i = $rfoo->m_int;

C::DynaLib::Struct 0.55 Screenshot

Advertisements

C::DynaLib::Struct 0.55 Keywords

Bookmark C::DynaLib::Struct 0.55

Hyperlink code:
Link for forum:

C::DynaLib::Struct 0.55 Copyright

WareSeeker periodically updates pricing and software information of C::DynaLib::Struct 0.55 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of C::DynaLib::Struct 0.55 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
C::DynaLib is a Perl interface to C compiled code. Free Download
Inline::Struct is a Perl module that manipulate C structures directly from Perl. Free Download
Test::Struct is a Perl extension for testing for structural equivelence. Free Download
Module::Signature is a Perl module signature file manipulation. Free Download
mpTcv is a GUI for LAME to convert MP3 to other bit rates. Free Download
Instant is a Python module that allows for instant inlining of C and C++ code in Python. Free Download
AllPeers Beta allows you to organize and share your media files privately and securely. Free Download
Class::Struct::FIELDS module combine Class::Struct, base and fields. Free Download