Skip to content

Instantly share code, notes, and snippets.

@sunfmin
Created June 28, 2021 07:41
Show Gist options
  • Save sunfmin/2079126df5878a61d871e3152cce5f0d to your computer and use it in GitHub Desktop.
Save sunfmin/2079126df5878a61d871e3152cce5f0d to your computer and use it in GitHub Desktop.
在Go里调用chiapos的静态库
mkdir build
cd build
cmake ../
cmake --build . --config=Release

在build/Release生成了 chiapos.libgochiapos.lib等文件

main.go

package main

// #cgo LDFLAGS: -LC:/code/chiapos/build/Release/ -lgochiapos
// int hello();
import "C"
import "fmt"

func main(){
	fmt.Println(C.hello())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment