Skip to content

Setting up BearLibTerminal (Windows)

Jeremy Cerise edited this page Apr 9, 2020 · 4 revisions

In order to use Gogue, BearLibTerminal must be present and configured on your system. The choice to use BearLibTerminal (henceforth BLT) was made due to its wonderful set of functionality, and generally easy to use API.

Unfortunately, Windows is the most complicated system to get BearLibTerminal (using the Go bindings, at least) running on, out of the three (Windows, Linux, Mac), due to a lack of GCC compiler, and some other quirks. In particular, we can't use the gogue-framework Go Package, as we need some Windows specific bindings in our BearLibTerminal package. So, these instructions will walk you through creating a local BearLibTerminal Go package to use in your project.

  1. Download BLT for Windows here - Make sure to get the Windows distribution. Un-archive it somewhere.

  2. In your $GOPATH/src directory, create a new directory called bearlibterminal.

  3. From your BLT download, copy the BearLibTerminal.dll and BearLibTerminal.lib files from the Windows64 directory into your $GOPATH/src/bearlibterminal directory.

  4. From your BLT download, copy the BearLibTerminal.h file from the Include/C directory to your $GOPATH/src/bearlibterminal directory.

  5. From your BLT download, copy the BearLibTerminal.go file from Include/Go into $GOPATH/src/bearlibterminal.

  6. From a terminal, navigate to your $GOPATH/src/bearlibterminal directory, and run go mod init. This should create a go,mod file in your bearlibterminal directory, and will allow us to include our BearLibTerminal go library in our projects.

At this point, we'll need to go and download and install a GCC compiler implementation for Windows. There are a couple choices, but I recommend using TDM-GCC (and so does the author of BearLibTerminal), due to its quirks implementations. You can find that here. Grab the latest, and install, ensuring you add it to your PATH. Make sure you install the 64bit version!

  1. Copy the BearLibTerminal.lib and BearLibTerminal.dll files to your TDM-GCC installations lib folder. Mine was located at C:\TDM-GCC-64\lib, but your location may vary.

  2. We are finally ready to build our BearLibTerminal Go library! In your $GOPATH/src/bearlibterminal, run go build. This should result in no output. If thats the case, you're all set to use BearLibTerminal in your Go projects!