in reply to Re^5: Really, really suffering from buffering
in thread Really, really suffering from buffering
As you say, the problems that you faced there may well be related to the problems I've been looking at - though I still have this notion that (at least part of) your problem might arise from the involvement of *2* C runtime libraries.void test2 ( char* text ) { PerlIO_printf( PerlIO_stderr(), "Got:'%s'\n", text ); }
Cheers,use warnings; use strict; use Inline C => Config => INC => '-IC:/_32/C', LIBS => '-LC:/_32/C -lmylib', BUILD_NOISY => 1; use Inline C => <<'EOC'; #include <mylib.h> void _foo(PerlIO * stream) { FILE * stdio_stream = PerlIO_exportFILE(stream, NULL); my_puts(stdio_stream); fflush(stdio_stream); PerlIO_releaseFILE(stream, stdio_stream); } void _foo2(PerlIO * stream, SV * suffix) { FILE * stdio_stream = PerlIO_exportFILE(stream, NULL); my_puts(stdio_stream); fflush(stdio_stream); PerlIO_releaseFILE(stream, stdio_stream); PerlIO_printf(stream, "%s", SvPV_nolen(suffix)); PerlIO_flush(stream); } EOC for(1 .. 2) { foo(*stdout, "\nhello from perl\n"); } for(1 .. 2) { foo(*stderr); print "\nhello from perl\n"; } sub foo { if(@_ == 1) { _foo($_[0]) } elsif(@_ == 2) { _foo2($_[0], $_[1]) } else {die "Wrong no. of args to foo" } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Really, really suffering from buffering
by BrowserUk (Patriarch) on Nov 22, 2007 at 07:27 UTC |