Original post

Hi,

I’m using library as .a file and which need to be whole imported during linked process.

Unfortunately the flag -Wl,-all_load doesn’t work on MacOS and the flag -Wl,--whole-archive doesn’t work on Linux:

#cgo darwin LDFLAGS: -L.. -Wl,-all_load -lmy_lib

go build _/Users/thierryfournier/git/my-lib/my_lib: invalid flag in #cgo LDFLAGS: -Wl,-all_load

nor the whole archive on Linux:

#cgo LDFLAGS: -L.. -Wl,--whole-archive -lmy_lib

go build _/home/thierry/my_lib/my_lib: invalid flag in #cgo LDFLAGS: -Wl,--whole-archive

So, i don’t found any way to embed the whole library.

  • I don’t find a way to understand how the linker is called
  • I don’t find documentation about supported flag.

If anyone has a solution or a clue, it will be welcome

Thanks,
Thierry