I'm new to Go and trying to learn how to call C from Go. I wrote this program to open a named semaphore, get the value and print it to the screen. When I run it go build semvalue.go I get the error: ./semvalue.go:16:14: unexpected type: ...
What does this mean? What am I doing wrong?
package main import "fmt" // #cgo LDFLAGS: -pthread // #include <stdlib.h> // #include <fcntl.h> // #include <sys/stat.h> // #include <semaphore.h> import "C" func main() { name := C.CString("/fram") defer C.free(name) fram_sem := C.sem_open(name, C.O_CREAT, C.mode_t(0644), C.uint(1)) var val int ret := C.sem_getvalue(fram_sem, val) fmt.Println(val) C.sem_close(fram_sem) } Thank you.