there are a few problems with your project as presented:
- your .c file has a (mistyped) directive to not build on linux on
line 1: "/ build !linux". this needs to go
- your a_non_linux.go file is not idiomatic. it makes much more sense
to specialize the linux code in a separate file and leave
Hi Sebastien,
Thanks for the response but this does not work completely. The issue is
demonstrated in a package here:
github.com/satyamsi/cbuilds/a
One file a.go build for linux and has an import "C" - this works fine.
On non-linux, a_non_linux.go gets used. As this file doesnt use anything
Hi Folks,
If I need to compile c files in a package conditionally based on the OS
that I am running on, seems like +build is the right way to do it. I can
have two versions of the file:
somefile_linux.go which has // +build linux and also an import "C"
and
somefile_nonlinux.go which has