Hi,
In both `go build main.go`-examples, you tell the compiler to
_only_ build `main.go`.
In your first example, `main.go` probably imports both `util` and `lib` (you might want to give them less generic names by the way). The go compiler thus knows "to build `main.go`, I need to build both `util` and `lib` and link them in".
In the second example, it has no way of knowing where `load_pattern_db` comes from, since you didn't tell it to compile a file that defines that function.
The examples where you omit the `main.go` tell the compiler "build the package in this directory", which includes all `.go`-files in the directory. `node.c` and `node.h` are likely built because of `cgo` directives in `a.go`.
The compiler and linker did exactly as you told them to.
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CALjMrq6gpXPbED%2BK2xiOKYvRg08FZwkjoPSUaGg%3DFu5hKP-%2BKQ%40mail.gmail.com.
-- -- Gregor Best be...@pferdewetten.de
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d23423e6-f204-8e63-436b-aa3730013392%40pferdewetten.de.
Hi,
it looks like my initial reply wasn't entirely correct. It should
build if you pass in both the `.go` file and the `.c` file.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CALjMrq6gpXPbED%2BK2xiOKYvRg08FZwkjoPSUaGg%3DFu5hKP-%2BKQ%40mail.gmail.com.
-- -- Gregor Best be...@pferdewetten.de
--
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 golan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d23423e6-f204-8e63-436b-aa3730013392%40pferdewetten.de.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/cfddeb60-03af-4f87-a6a8-74f76fb069a5%40googlegroups.com.
Hi Jake,Is there some reason that you want, or need, to be using go build this way, by specifying files? Or is it just curiosity about how the tools work?>>There is no particular reason to use go build by specifying the files. I was trying different ways to compile the project and ended up with this scenario.I am curious to know the reason for this.The typical way to use go build is to build without specifying individual files. If you are using CGO, I would certainly recommend that you do it by building as a package, just to keep things simple. Not that CGO is ever simple.>> I will try compiling the package without specifying the individual files.
But the following case works all fine whether we pass the individual file or not.:
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/cfddeb60-03af-4f87-a6a8-74f76fb069a5%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcX5tMbQ-r1zxNkjp6pM0nh0UY50jBZSesgHS54OmZJGtw%40mail.gmail.com.