August 2019
Beginner to intermediate
798 pages
17h 2m
English
This subsection will present you with the Go source code for the example, which will be named callC.go and will be presented to you in three parts.
The first part of callC.go comes with the next Go code:
package main
// #cgo CFLAGS: -I${SRCDIR}/callClib
// #cgo LDFLAGS: ${SRCDIR}/callC.a
// #include <stdlib.h>
// #include <callC.h>
import "C"
The single most important Go statement of the entire Go source file is the inclusion of the C package using a separate import statement. However, C is a virtual Go package that just tells go build to preprocess its input file using the cgo tool before the Go compiler processes the file. You can still see that you need to use comments to inform the Go program about the C code. In this case, ...
Read now
Unlock full access