package main
// #cgo CFLAGS: -I./lib
// #cgo LDFLAGS: -L./lib -lfifo
// #include "shmfifo.h"
import "C"
func main() {
fifo := C.shmfifo_init(13, 3, 64)
for i := 1; i <= 100; i++ {
C.shmfifo_put(fifo, 9)
}
}
上图是我的项目结构。我想把go源码链接到同目录lib下的dylib动态库上,但是gcc一直提示找不到动态库。
$ go build pppp.go
# command-line-arguments
ld: library not found for -lfifo
clang: error: linker command failed with exit code 1 (use -v to see invocation)