On Sun, Apr 21, 2019 at 7:16 PM <lgod...@gmail.com> wrote: > > For this simple go code, the *.exe file size is 1800 KB ...why so large > compared to equivalent C-compiled code ?? > package main > import( "math"; "fmt" ) > func main() { > fmt.Printf("\n %8.3f", math.Sin(1.2) ) > } > Does the go generated *.exe file contain code only for math.Sin() or all the > functions that comprise "math" ? > > Obviously there much more in the go *.exe file because of "fmt", but the > basic question still is why is the go *.exe file so large ?? > In addition to Sin() and Printf() what else is contained in the go *.exe file > ??
In addition to what other people said, Go programs are statically linked by default, while C++ programs are dynamically linked by default. Try comparing the size of "cc -static". Go is still bigger, but not quite as much. 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.