main文件:
package main
import(
"fmt"
"a"
)
func main(){
fmt.Println(a.Hello("ggggg"))
}
a文件:
package a
import(
_ "unsafe"
_ "b"
)
//go:linkname hello b.hello
func hello(name string) string
func Hello(name string) string{
return hello(name)
}
b源文件:
package b
func hello(name string) string{
return "hello," + name
}
同时需要添加空的扩展名为.s的文件
开发是需要把GOPATH设置到工程目录