It is also possible to call a Go function from your C code. Therefore, this section will present you with a small example where two Go functions are going to be called from a C program. The Go package is going to be converted into a C shared library that is going to be used in the C program.
Calling Go functions from C code
The Go package
This subsection will present you with the code of the Go package that will be used in a C program. The name of the Go package needs to be main but its filename can be anything you want; in this case, the filename will be usedByC.go and it will be presented in three parts.
You will learn more about Go packages in Chapter 6, What You Might Not Know About Go Packages and Go Functions.
The first part...