[BioLib-dev] Perl file pointers

Chris Fields cjfields at illinois.edu
Tue Feb 9 23:22:56 UTC 2010


On Feb 9, 2010, at 7:10 AM, Pjotr Prins wrote:

> Hi Chris,
> 
> Thanks for testing! I would think the FILE* can be used as an
> opaque SWIG pointer to an object - just like FILE * is handled
> normally. Unless you need to access the contents of the struct, or
> when you need to pass it into another Perl method (which may be the
> case, for example, with your Perl::IO factory). 
> 
> If you need it fast, I may be able to look into it tomorrow.
> 
> There may be a hint in the SWIG PERL macros that come with SWIG itself
> (/usr/share/swig?). SWIG is not well documented in this area. The guy
> who did the Perl Math GSL mappings had quite a few tricks. See
> http://leto.net/code/Math-GSL/. I can look into that in April. It is
> one of those areas in SWIG... What may also help is read the generated C
> code (at least, if C does not send you screaming). It helps.
> 
> Pj.

Forgot about Duke Leto's code, so will look at that as well as the SWIG macros.  We basically need some way of creating the C file pointer and passing it in for files that have multiple records, where we want to iterate through the reads.  The prior typemapping code I posted is fairly typical for SWIG perl mappings, but it doesn't seem to work yet.

io_lib also has mfread_reading which accepts mFILE *, not sure how to handle that yet.

chris



More information about the BioLib-dev mailing list