The .go file can just be a dummy file with no real purpose?

On Wednesday, April 12, 2017 at 5:06:35 PM UTC-7, Ian Lance Taylor wrote:
>
> On Wed, Apr 12, 2017 at 4:42 PM, larry104 <larg.w...@gmail.com 
> <javascript:>> wrote: 
> > 
> > I seems I need to manually run swig (swig -go -cgo -c++ -intgosize 64 
> > mylib.i) - it does not seem that 'go build' picks up the .i or .swig 
> file. 
> > Then I need to call 'go tool cgo mylib.go'. This creates an _obj 
> directory 
> > with a bunch of files. After that I tried calling 'go build'. This 
> errors 
> > out when my c++ code refers to some 3d party libs. How can I tell 'go 
> build' 
> > additional flags for compiling and linking like -I and -L flags? 
>
> When the go tool sees a .swig (for C) or .swigcxx (for C++) file, it 
> will invoke SWIG itself.  The file should be in the same directory as 
> the Go sources for the package.  See 
> https://golang.org/cmd/go/#hdr-Calling_between_Go_and_C .  Note that 
> there must be at least one .go files in the directory, and it needs to 
> be in a proper GOPATH directory. 
>
> Nevertheless, it should work to run SWIG yourself.  But running `go 
> tool cgo` yourself is just going to end in tears.  You're going to 
> need to let the go tool run cgo on your behalf. 
>
> To get -I and -L options, add a .go files that uses import "C" and 
> #cgo CFLAGS and #cgo LDFLAGS.  See https://golang.org/cmd/cgo and 
> https://github.com/golang/go/issues/6696#issuecomment-89016670 . 
>
> 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.

Reply via email to