On Apr 3, 2006, at 9:46 PM, Sisyphus wrote:

One thing that puzzles me is that 'perldoc perlclib' recommends using the PerlIO* types instead of the FILE* types. If that's the recommendation, then it seems anomalous that perl facilitates the passing of a FILE* from perl to XS, but not the passing of a PerlIO* from perl to XS. (At least that's the
way it appears to me at the moment.)

Does Inline::C use typemaps? If so, then it should be as simple as just declaring your argument and/or return types as PerlIO* instead of FILE*. Here's the relevant recipe from ExtUtils/typemap for 5.8.6:

PerlIO *                T_INOUT

### INPUT

T_INOUT
        $var = IoIFP(sv_2io($arg))

### OUTPUT

T_INOUT
        {
            GV *gv = newGVgen("$Package");
            if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) )
                sv_setsv($arg, sv_bless(newRV((SV*)gv), 
gv_stashpv("$Package",1)));
            else
                $arg = &PL_sv_undef;
        }

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Reply via email to