Chilkat Go Language Package
for Windows, Linux, Alpine Linux, MAC OS X, Solaris
* For Raspberry Pi 2/3, use Linux armhf/aarch64 downloads.
1) Download chilkat_go.zip to $GOPATH/src and unzip
Creates 3 directories under $GOPATH/src:
- chilkat: The "chilkat" package. Contains .go source files, one per Chilkat class.
- chilkat_example1: Simple example program making use of the "chilkat" package.
- chilkat_example2: Example program demonstrating async methods and event callbacks.
Note: If $GOPATH is unset, then GOPATH defaults to a subdirectory named "go" in the user's home directory.
2) Download One of the Native "C" Chilkat Go Libs
Choose the native "C" Chilkat library that matches your operating system, architecture, etc.
(The "libchilkatext-9.5.0.a" is contained in the native "C" download.)
If on Windows, see How to Choose the Native "C" Chilkat Go Library on Windows
Download and extract to a directory of your choosing, such as $HOME/go_chilkat_c/
See Native "C" Downloads Below...
3) Set the CGO_LDFLAGS Environment Variable
Find the directory where the libchilkatext-9.5.0.a is located. This will be the directory for the -L option.
For example, -L$HOME/go_chilkat_c/linux-x64-gcc
On non-Windows systems, set the CGO_LDFLAGS to "-L$HOME/go_chilkat_c/linux-x64-gcc -lchilkatext-9.5.0 -lresolv -lpthread -ldl -lstdc++".
On Windows systems, use "-lws2_32". For example, CGO_LDFLAGS might be set to "-LC:/go_chilkat_c/x86_64-10.0.0-posix-seh -lchilkatExt-9.5.0 -lws2_32 -lstdc++".
On Mac OS X systems, set CGO_LDFLAGS
to "-L$HOME/go_chilkat_c/macosx-x86_64-clang -lchilkatext_x86_64 -lpthread -lresolv -ldl -lstdc++"
or "-L$HOME/go_chilkat_c/macosx-i386-clang -lchilkatext_i386 -lpthread -lresolv -ldl -lstdc++"
Note: Case sensitivity matters: The Windows lib is "chilkatExt", others are "chilkatext".
4) Build the "chilkat" package.
In $GOPATH/src/chilkat, run the following commands:
(if $GOPATH is unset, then in $HOME/go/src/chilkat)
go mod init chillkat go build go install
Note: go build takes some time, perhaps a minute or two.
5) Build and Run the Example Programs.
In $GOPATH/src/chilkat_example1, type go build. Then run chilkat_example1.
In $GOPATH/src/chilkat_example2, type go build. Then run chilkat_example2.
6) Finished
Also see: Getting Started with Chilkat Go on Ubuntu Linux
See Chilkat Go Reference Documentation and Chilkat Go Examples.
Static Linking on MinGW/Linux to Remove stdlibc++ Dependency
See Go Language Static Linking
Also see Statically Compiling Golang application with CGO_ENABLED
Go Language Debugging in Visual Studio Code with a Native "C" Lib
To debug a Go application that uses a native library, define "evn" in the launch.json file. For example:
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 //"showLog" : true, //"trace" :"verbose", //"logOutput":"rpc", "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "go", "request": "launch", "mode": "auto", "program": "${fileDirname}", "env": {"CGO_LDFLAGS":"-LC:/go_chilkat_c/tdm-5.1.0-64 -lchilkatExt-9.5.0 -lws2_32 -lstdc++"}, "args": [] } ] }
Native "C" Chilkat Go Libs
Windows · Linux · Alpine Linux · MAC OS X · Solaris
Linux Native "C" Chilkat Go Libs
Alpine Linux Native "C" Chilkat Go Libs
MAC OS X Native "C" Chilkat Go Libs
Solaris Native "C" Chilkat Go Libs
Windows Native "C" Chilkat Go Libs
See How to Choose the Native "C" Chilkat Go Library on Windows