package main
import("fmt""runtime""github.com/ebitengine/purego")funcgetSystemLibrary()string{switch runtime.GOOS {case"darwin":return"/usr/lib/libSystem.B.dylib"case"linux":return"libc.so.6"default:panic(fmt.Errorf("GOOS=%s is not supported", runtime.GOOS))}}funcmain(){
libc, err := purego.Dlopen(getSystemLibrary(), purego.RTLD_NOW|purego.RTLD_GLOBAL)if err !=nil{panic(err)}var puts func(string)
purego.RegisterLibFunc(&puts, libc,"puts")puts("Calling C from Go without Cgo!")}