|
Posted by krg on October 22, 2005, 5:39 am
Please log in for more thread options
Ilya Zakharevich wrote:
> [A complimentary Cc of this posting was sent to
> krg
> > The problem, is that until I include the Perl Interpreter
> > instance and the associated libraries, the file ops perform real smooth
> > and ok, but once i include the Perl handling code, the program again
> > compiles and links well, but crashes at the file opening op. And that's
> > it, the start of my worries, and before it becomes the end, I want to
> > be led by some answers.
>
> You need a DMZ.
> http://en.wikipedia.org/wiki/Demilitarized_zone_%28computing%29
>
> In its baby years, Perl interpeter was using FILE* for its buffered
> I/O model. Now it uses PerlIO * instead of FILE *; to simplify
> transition from old XSUBs, there is a translation which maps FILE*
> operations to be replaced by PerlIO* operations. This translation is
> enabled, IIRC, by inclusion of "XSUB.h".
>
> If you need FILE* (e.g., to cooperate to external libraries), you need
> to proceed using the normal rules of engagement when an include
> conflict arises: use different .c files. Make wrappers for your FILE*
> functions in wrappers.c, expose the signature (which now uses no FILE*
> stuff) in wrappers.h. Include wrappers.h into wrappers.c (for
> consistency checking), and in your .xs. Call the wrappers from your
> .xs.
>
> Actually, there may be a layer of helpers in XSUB.h to simplify
> working around this common problem. Maybe somebody has more specific
> advice than one I gave? Maybe also :stdio IO discipline would somehow
> help here?
>
> Hope this helps,
> Ilya
Hi List,
And Thank you Ilya, it really helped. Since I went too far with the
FILE* management
stuff, I instead developed wrappers to Perl funcs and put them in a
separate file.
Ensured that either of FILE* or PerlInterpreter won't have to see each
other's face ever,
atleast in this program ... thank you again, and thanks to all who read
and replied.
<<<<<<<<<<<<<Discussion Closed>>>>>>>>>>>>>>>
|