Skip to content

Instantly share code, notes, and snippets.

@zelenko
Forked from tejainece/cgo1.go
Created August 11, 2018 02:07
Show Gist options
  • Save zelenko/09ad9b7d8255157122953b612fa2ce25 to your computer and use it in GitHub Desktop.
Save zelenko/09ad9b7d8255157122953b612fa2ce25 to your computer and use it in GitHub Desktop.
Examples of calling C code from Golang
package main
//#include<stdio.h>
//void inC() {
// printf("I am in C code now!\n");
//}
import "C"
import "fmt"
func main() {
fmt.Println("I am in Go code now!")
C.inC()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment