Last active
March 4, 2023 18:14
-
-
Save alexdyukov/51cbd8a3dc7c9c5ee276991a2b31dff5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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())' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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