[gdal-dev] Wrapping VSIStdoutSetRedirection

Ari Jolma ari.jolma at gmail.com
Tue Nov 10 09:22:19 PST 2015


I'd like to wrap VSIStdoutSetRedirection.

I would use it for streaming generated data in a web environment. The 
preferred way to stream data out nowadays in Perl web development is to 
use a write function in Perl space - i.e., not the standard print to stdout.

I can capture stdout and achieve the wanted goal that way but it is a 
bit too hackish I think.

I don't think the wrapping is such a big deal itself - it will require a 
bit unusual function typemap, so I'll limit it to Perl for now - but 
there is something in the C space I need to ask.

How can one undo a redirection done with VSIStdoutSetRedirection? It 
seems to me that it would need a function:

void VSIStdoutUnsetRedirection()
{
     pWriteFunction = fwrite;
     pWriteStream = stdout;
}

but there is no such. Should there be one?

Best,

Ari



More information about the gdal-dev mailing list