The source of the problem *is* perlIO. Not the underlying Windows CRT calls. With the PerlIO #defines in place, you cannot even do:
fprintf( stderr, ... );
Without perl crashing in a heap around your ears.
However, if in your XS code, you #undef stderr to bypass the ridiculous PerlIO redefinitions, things begin to work. But you also have to defeat all the other pointless PerlIO redefinitions.