Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.64 KB

README.md

File metadata and controls

49 lines (32 loc) · 1.64 KB

Using Go Shared Libraries

This project demonstrates a few new features that were added or improved in the Go 1.5 release:

  • -buildmode=shared - The ability to create a .so file from a Go package that can be called by other Go programs.
  • -linkshared - The ability to compile and link a Go program aginst previously compiled shared libraries.
  • -buildmode=c-shared - The ability to create a c-style .so file from a Go package that can be called by other languages.

This work is based on the Execmodes proposal found here. Keep in mind that this has only been tested on Linux. Certain features are not yet available on all Go platforms.

To get started, you'll need a working Go 1.5 installation. If you haven't already upgraded, follow the [download and install instructions here] (https://golang.org/dl).

To use these examples locally, I suggest you clone this repo:

$ mkdir buildmodeshared
$ git clone https://github.com/jbuberel/buildmodeshared buildmodeshared

Once you have the repo cloned, see the gofromgo and gofrompython directories for next steps.

  • Go from Go - The ability to compile a Go program that is dynamically linked to other Go libraries.
  • Go from Python - The ability to compile a set of Go packages into a C-style shared library that can be invoked from other languages, such as Pyhon.

Contributing

For details, see CONTRIBUTING.

LICENSE

For details, see LICENSE.

NOTE

This is not an official Google project.