Skip to content

Instantly share code, notes, and snippets.

Created July 17, 2016 19:48
What would you like to do?
Import Go from Python the "right" way
go build -buildmode=c-archive .
python -c "import _hello; _hello.lib.Hello()"
package main
import "C"
import ""
//export Hello
func Hello() {
color.Green("Hello, 世界")
func main() {}
from cffi import FFI
ffibuilder = FFI()
ffibuilder.set_source("_hello", """
#include "hello.h"
""", extra_objects=["hello.a"])
ffibuilder.cdef("void Hello();")
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment