Steve Hay <[EMAIL PROTECTED]> writes:
>Thanks once again for the excellent reply!
>
>My wrapper function now looks broadly like:
>
>    FILE *f;
>    PerlIO *p;
>
>    f = library_func(file, mode);
>
>    // Force binary mode for underlying FILE *.
>    PerlLIO_setmode(PerlSIO_fileno(f), O_BINARY);
>
>    // Import FILE * to PerlIO *.
>    p = PerlIO_importFILE(f, mode);
>
>    // Push translation layer on PerlIO if required.
>    if (strchr(mode, 'b') == NULL)
>        PerlIO_binmode(p, type, O_TEXT, ":crlf");
>
>    // Now store PerlIO in used-supplied glob ref...
>
>This works perfectly under my Perl without PERL_IMPLICIT_SYS enabled 
>(including the example quoted above), but I still have the same problem 
>with PerlIO_binmode() that I reported previously when building against a 
>Perl with PERL_IMPLICIT_SYS enabled: "different types for formal and 
>actual parameter" 1, 2 and 4, and "too few actual parameters".
>
>I'm still not sure I understood what you said earlier on this point. 
> You mentioned a perlsio_binmode() function in "perlio.c", but that 
>operates on a FILE *, not a PerlIO * like I'm doing here, so I wouldn't 
>want to use it here even if it was exported as PerlSIO_binmode().
>
>Why does the PerlIO_binmode() in the outline of my wrapper function 
>above cause a problem?  Is it something that I'm doing wrong, 

No - I think the code above is now fine.
The only question I have is whether you realy want to do CRLF translation 
if you run this on UNIX and user just asks for "w" without a "b".
perlio.c only does that if O_TEXT != O_BINARY so UNIX etc will 
not do CRLF.

>or a 
>teething problem with stdio/PerlIO co-existence in ActivePerl that I 
>can't do anything about in my code?

I think that is it - it seems that PERL_IMPLICIT_SYS parts of XSUB.h 
need some work. 

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/

Reply via email to