summaryrefslogtreecommitdiffstats
path: root/misc/cgo/stdio/testdata/stdio/stdio.go
diff options
context:
space:
mode:
Diffstat (limited to 'misc/cgo/stdio/testdata/stdio/stdio.go')
-rw-r--r--misc/cgo/stdio/testdata/stdio/stdio.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/misc/cgo/stdio/testdata/stdio/stdio.go b/misc/cgo/stdio/testdata/stdio/stdio.go
new file mode 100644
index 0000000..d216e44
--- /dev/null
+++ b/misc/cgo/stdio/testdata/stdio/stdio.go
@@ -0,0 +1,22 @@
+// skip
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package stdio
+
+/*
+#include <stdio.h>
+
+// on mingw, stderr and stdout are defined as &_iob[FILENO]
+// on netbsd, they are defined as &__sF[FILENO]
+// and cgo doesn't recognize them, so write a function to get them,
+// instead of depending on internals of libc implementation.
+FILE *getStdout(void) { return stdout; }
+FILE *getStderr(void) { return stderr; }
+*/
+import "C"
+
+var Stdout = (*File)(C.getStdout())
+var Stderr = (*File)(C.getStderr())