On Tue, Jan 14, 2003 at 04:56:37PM +0000 Nick Ing-Simmons wrote:
> Tassilo Parseval <[EMAIL PROTECTED]> writes:

[...]

> >So how would I go about converting the macro
> >
> >#define sv_to_file(sv) (PerlIO_exportFILE(IoIFP(sv_2io(sv)), NULL))
> >
> >to something Windows would understand? I would be using 
> >PerlIO_fileno() instead but as far as I know there's no way to gain a FILE 
> >pointer from a file-descriptor (or else correct me) and the library wrapped 
> >by this XS explicitely needs a FILE*. The whole thing is supposed to 
> >eventually work with ActiveState's Perl.
> 
> If I recall correctly ActiveState perl is still perl5.6.? and so 
> does not (really) have PerlIO - that is to say a PerlIO * _is_ a FILE *.

Oh, that's convenient!

> However in such a system you are supposed to have PerlIO_exportFILE 
> as a #define something like 
> 
> #define PerlIO_exportFILE(f,n) (f)

You are right. I stumbled over this line several times while trying to
get an insight from the headers. It's basically a no-op and now I
understand why this is so.

> You probably need to #define something else _before_ including perl.h 
> and hence perlio.h and perlstdio.h to get FILE * visible.
> I don't have an perl5.6 source base to hand to check what that is 
> but from memory it was something like:
> 
> #define PERLIO_NOT_STDIO 0
> #include <perl.h>

That could be. perlio.h has something quite promising:

#ifdef PERLIO_NOT_STDIO
#if PERLIO_NOT_STDIO
/*
 * PERLIO_NOT_STDIO #define'd as 1
 * Case 1: Strong denial of stdio - make all stdio calls (we can think
 * of) errors
 */
#include "nostdio.h"
#else               /* if PERLIO_NOT_STDIO */
/*
 * PERLIO_NOT_STDIO #define'd as 0
 * Case 2: Declares that both PerlIO and stdio can be used
 */
#endif              /* if PERLIO_NOT_STDIO */
#else               /* ifdef PERLIO_NOT_STDIO */
/*
 * PERLIO_NOT_STDIO not defined
 * Case 3: Try and fake stdio calls as PerlIO calls
 */
#include "fakesdio.h"
#endif              /* ifndef PERLIO_NOT_STDIO */
#endif              /* PERLIO_IS_STDIO */

One of the three above will possibly apply. From the comments
'#define PERLIO_NOT_STDIO 0' looks most likely.

Thanks for the prompt reply! I haven't yet tested it but I am confident
that it's one of the above.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;

Reply via email to