Implement more cgo support

Fixes #72