develooper Front page | perl.perl5.porters | Postings from February 2012

Re: XS Typemap documentation and related changes

Thread Previous | Thread Next
Craig A. Berry
February 2, 2012 17:21
Re: XS Typemap documentation and related changes
Message ID:
On Thu, Feb 2, 2012 at 1:21 AM, Steffen Mueller <> wrote:
> On 02/02/2012 05:50 AM, Craig A. Berry wrote:
>> On Wed, Feb 1, 2012 at 1:47 AM, Steffen Mueller<>  wrote:
>>> Hi all,
>>> The changes outlined below are now in blead. You know where to find me
>>> for
>>> sending bombs.
>> No bombs, just a couple of friendly stun grenades from the compiler I'm
>> using:
> [...]
> Pushed a change to disable these tests.

I reverted that change and pushed the following, which builds and
passes on  VMS and OS X:

commit 08d5d1db9586f83ed261965aabe8db9e99502648
Author: Craig A. Berry <>
Date:   Thu Feb 2 18:50:44 2012 -0600

    Resurrect PerlIO-related typemap tests.

    Apparently we were just missing the fact that T_IN and T_OUT are
    pointers to PerlIO structs, not PerlIO structs themselves, which
    kinda makes sense as you wouldn't normally have an entire struct
    as a return value.

diff --git a/ext/XS-Typemap/Typemap.xs b/ext/XS-Typemap/Typemap.xs
index d69a700..3dc5b88 100644
--- a/ext/XS-Typemap/Typemap.xs
+++ b/ext/XS-Typemap/Typemap.xs
@@ -30,8 +30,8 @@ typedef int intTLONG; /* T_LONG */
 typedef short shortOPQ;   /* T_OPAQUE */
 typedef int intOpq;   /* T_OPAQUEPTR */
 typedef unsigned intUnsigned; /* T_U_INT */
-typedef PerlIO inputfh; /* T_IN */
-typedef PerlIO outputfh; /* T_OUT */
+typedef PerlIO * inputfh; /* T_IN */
+typedef PerlIO * outputfh; /* T_OUT */

 /* A structure to test T_OPAQUEPTR and T_PACKED */
 struct t_opaqueptr {

I find it a bit strange that lib/ExtUtils/typemap has:

FileHandle		T_PTROBJ
InputStream		T_IN
InOutStream		T_INOUT
OutputStream		T_OUT

So we know that T_INOUT is a pointer to PerlIO because it's defined
twice, one of them being as the InOutStream alias, or convenience
synonym, or whatever it should be called in this context, but nothing
similar exists for T_IN and T_OUT.

I have no idea and could not (easily) figure out how xsubpp converts
something such as InputStream to an actual C typedef (presumably
"PerlIO *").  But thanks to Steffen for starting to swat at the

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About