summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorRobin Barker <RMBarker@cpan.org>2005-01-04 12:32:29 +0000
committerH.Merijn Brand <h.m.brand@xs4all.nl>2005-01-04 12:38:03 +0000
commit049cb4115f5677ea81b63ce0025e2bc136637c77 (patch)
tree49b951a1ff1d2a5724050b5f78f438c3edd9d014 /pod
parent7cebcbc0979cbf6a0b15188e491cb65c675adbe5 (diff)
downloadperl-049cb4115f5677ea81b63ce0025e2bc136637c77.tar.gz
RE: [perl #32660] INT2PTR not mentioned in perlxs(1)
Message-ID: <533D273D4014D411AB1D00062938C4D90849C553@hotel.npl.co.uk> p4raw-id: //depot/perl@23742
Diffstat (limited to 'pod')
-rw-r--r--pod/perlxs.pod7
1 files changed, 6 insertions, 1 deletions
diff --git a/pod/perlxs.pod b/pod/perlxs.pod
index c09947d65c..a8196975aa 100644
--- a/pod/perlxs.pod
+++ b/pod/perlxs.pod
@@ -1833,7 +1833,7 @@ double-colons (::), and declare C<Net_Config> to be of that type:
T_PTROBJ_SPECIAL
if (sv_derived_from($arg, \"${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
- $var = ($type) tmp;
+ $var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type ${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")
@@ -1847,6 +1847,11 @@ The INPUT and OUTPUT sections substitute underscores for double-colons
on the fly, giving the desired effect. This example demonstrates some
of the power and versatility of the typemap facility.
+The INT2PTR macro (defined in perl.h) casts an integer to a pointer,
+of a given type, taking care of the possible different size of integers
+and pointers. There are also PTR2IV, PTR2UV, PTR2NV macros,
+to map the other way, which may be useful in OUTPUT sections.
+
=head2 Safely Storing Static Data in XS
Starting with Perl 5.8, a macro framework has been defined to allow