Asking opinion of the inline group (after some discussion with maintainer Rob)
1) The following program illustrates a bug that I found rather hard
(for someone who never used XS before), to figure out why it the
"noio" version would ONLY fail when redirected to a file.....
= cut
use Inline C => <<'END_C';
void noio(int i) {
printf("%d, bar no-io\n", i);
}
END_C
# this comes out in the wrong order, but only when redirected to a file
for ($i =0; $i < 10; ++$i) {
print STDOUT $i, "\n";
noio(++$i);
}
= cut
2) This one line sufices to fix the issue.
AUTO_INCLUDE => "#include <fakesdio.h>"
(my version of the CORE fakesdio had a bug ... line 68 needed to be
deleted, i think most version have this issue)
3) It might be a good idea, since many inline users are using inline
specifically because they don't know as much about perl's XS library,
to have:
USE_PERLIO => 1
which would be a documented shortcut that appends
#include "FAKESDIO.H"
.... (then bundle a version of FAKESDIO.H that doesn't have a bug in
it, until such time as it's been fixed for at least a year or so)
4) i would even go so far s to say this should be the default ...
perlapio documentation quotes "extensions that want maximum
portability, should use the above functions instead of those defined
in ANSI C's stdio.h" ...
I doubt very much if it woul break the typical Inline user's code, and
might improve efficiency (why have 2 buffers when 1 is more
efficient) and threading (yes, stdio functions will crash under
certain conditions of threading)
- Erik