bind: cgo-cosmetics

This commit is contained in:
Sebastien Binet 2015-07-30 16:04:46 +02:00
parent 0feb50a4bc
commit c8787de724
1 changed files with 3 additions and 2 deletions

View File

@ -88,9 +88,10 @@ func (g *goGen) gen() error {
g.genFunc(f)
}
g.Printf("// buildmode=c-shared needs a 'main'\n\nfunc main() {}\n")
g.Printf("// tickle cgo\nfunc init() {\n")
g.Printf("// buildmode=c-shared needs a 'main'\nfunc main() {}\n\n")
g.Printf("func init() {\n")
g.Indent()
g.Printf("// make sure cgo is used and cgo hooks are run\n")
g.Printf("str := C.CString(%q)\n", g.pkg.Name())
g.Printf("C.free(unsafe.Pointer(str))\n")
g.Outdent()