Skip to content

Instantly share code, notes, and snippets.

@alexdyukov
Last active March 4, 2023 18:14
Show Gist options
  • Save alexdyukov/51cbd8a3dc7c9c5ee276991a2b31dff5 to your computer and use it in GitHub Desktop.
Save alexdyukov/51cbd8a3dc7c9c5ee276991a2b31dff5 to your computer and use it in GitHub Desktop.
#!/bin/sh
CGO_ENABLED=1 go build -v -o libhello.so -buildmode=c-shared libhello.go
python3 -c 'import ctypes;lib = ctypes.CDLL("./libhello.so");print(lib.HelloWorld())'
package main
import (
"fmt"
"C"
)
//export HelloWorld
func HelloWorld() {
fmt.Println("Hello World!")
}
func main() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment