We provide a Go module with a single ddlog
package which defines wrappers
around the DDlog C API.
Building this package requires access to the ddlog.h header file along with the dynamic library generated by DDlog for your program. We use cgo to invoke the DDlog C API and we expect the following environment variables to be set at build time:
CGO_CPPFLAGS
must be set so that the directory including ddlog.h is added to the C compiler's search path.CGO_LDFLAGS
must be set so that the linker searches the dynamic library generated for your program.
For an example, refer to cmd/example/, which is a Go program
using the DDlog Go bindings. This program assumes that the DDlog program
typesTest.dl is the one being used. The example
can be built and run with ./run-example.sh
. Refer to this script to understand
how to set CGO_CPPFLAGS
and CGO_LDFLAGS
.
If you make changes to the ddlog
Go package, you can validate your changes by
running the unit tests with ./run-tests.sh
.