The cgo compiler cannot handle variable arguments in c functions and macros in c header files at present, so you cannot make simple
import "C"
func GetWinSz() {
var ts C.ttysize;
C.ioctl(0,C.TIOCGWINSZ,&ts)
}
To bypass macros, use a constant, therefore
import "C"
const TIOCGWINSZ C.ulong = 0x5413;
func GetWinSz() {
var ts C.ttysize;
C.ioctl(0,TIOCGWINSZ,&ts)
}
However, cgo will still be ... on the ioctl prototype. It would be best to wrap ioctl with a c function, taking a certain number of arguments and binding it. As a hack, you can do this in the comments above to import "C"
import "C"
const TIOCGWINSZ C.ulong = 0x5413;
func GetWinSz() {
var ts C.ttysize;
C.myioctl(0,TIOCGWINSZ,&ts)
}
, - .