how ever if I exec > go build -buildmode=c-archive -o libmug.a ./src
for mac lib build it build both and failed so does for ios lib , it compile fail > CC=$PWD/clangwrap.sh CXX=$PWD/clangwrap.sh GOOS=darwin GOARCH=arm > CGO_ENABLED=1 go build -buildmode=c-archive -o libmug.a ./src If I comment each #cgo sperately for defferent build , it works fine 2017-04-19 21:31 GMT+08:00 Ian Lance Taylor <i...@golang.org>: > On Tue, Apr 18, 2017 at 11:00 PM, hui zhang <fastfad...@gmail.com> wrote: > > I want to set different flags for different os in cgo, how to do that in > > cgo? > > > > > >> //#cgo amd64 darwin CFLAGS: -Dxxx > >> //#cgo amd64 darwin CXXFLAGS: -Dxxx > >> //#cgo amd64 darwin LDFLAGS: -Lxxx > >> //#cgo arm darwin CFLAGS: -Dxxx > >> //#cgo arm darwin CXXFLAGS: -Dxxx > >> //#cgo arm darwin LDFLAGS: -Lxxx > >> > >> //#include "c2go.h" > >> import "C" > > Yes, that is how to do it, as documented at https://golang.org/cmd/cgo. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.