Added cgo modifications to allow the library to compile on OS-X.