I’m trying to build the following example from C? Go? Cgo!:
package print
/*
#include <stdio.h>
#include <stdlib.h>
*/
import "C"
import "unsafe"
func Print(s string) {
cs := C.CString(s)
C.fputs(cs, (*C.FILE)(C.stdout))
C.free(unsafe.Pointer(cs))
}
I’m running Go on Win7 64 and am using the 64 bit version of GCC from http://tdm-gcc.tdragon.net/
Running this on Linux isn’t an option.
The error I get is:
could not determine kind of name for C.stdout
I haven’t been able to find any documentation on this message, and very few hits show up on Google.
Does anyone have ideas on what’s causing this? Thanks in advance!
Here is one way to access C.stdout on windows:
https://github.com/golang/go/blob/master/misc/cgo/stdio/stdio.go