Skip to content

jbuberel/buildmodeshared

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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.

About

How to use Go to build shared libraries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published