11-14 848 views
阅读全文 0
引用
package main
import (
"fmt"
"reflect"
"github.com/boringwork/godemo/class/stu"
)
var typeRegistry = make(map[string]reflect.Type)
func registerType(elem interface{}) {
t := reflect.TypeOf(elem).Elem()
typeRegistry[t.N...
9-21 1,809 views
引用
package main
import (
"fmt"
"reflect"
"github.com/boringwork/godemo/class/stu"
)
var typeRegistry = make(map[string]reflect.Ty...
Golang使用pkg-config自动获取头文件和链接库的方法
为了能够重用已有的C语言库,我们在使用Golang开发项目或系统的时候难免会遇到Go和C语言混合编程,这时很多人都会选择使用cgo。 话说cgo这个东西可算得上是让人又爱又恨,好处在于它可以让你快速重用已有的C语言...
9-04 731 views
阅读全文 0
https://www.jianshu.com/p/3232263a3da3
增加依赖库解决
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa -framework OpenGL
9-03 1,613 views
https://www.jianshu.com/p/3232263a3da3
增加依赖库解决
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa -framework OpenGL
golang init函数
init函数有一下几点特性:
init函数在main执行之前,自动被调用执行的,不能显示调用
每个包的init函数在包被引用时,自动被调用
每个包可以有多个init函数
同一个文件中可定义多个init()函数
相当于Java的静态函数 static{}
package main
import (...
5-30 2,309 views
阅读全文 11
https://github.com/golang/go/wiki/cgo
Introduction
First, http://golang.org/cmd/cgo is the primary cgo documentation.
There is also a good introduction article at http://golang.org/doc/articles/c_go_cgo.html.
The basics
If a Go source file import...
5-13 1,947 views
https://github.com/golang/go/wiki/cgo
Introduction
First, http://golang.org/cmd/cgo is the primary cgo documentation.
There is also a good introdu...
macos Delve could not launch process: EOF
I have a workaround.
sudo rm -rf /Library/Developer/CommandLineTools
Go to https://developer.apple.com/download/more/ and download Command Line Tools (macos 10.13) for XCode 9.2.
This will restore debuggi...
4-06 1,132 views
macos Delve could not launch process: EOF
I have a workaround.
sudo rm -rf /Library/Developer/CommandLineTools
Go to https://developer.apple.com/d...
Windows
go build -ldflags -H=windowsgui main.go
https://stackoverflow.com/questions/36727740/how-to-hide-console-window-of-a-go-program-on-windows
Mac
https://github.com/zserge/webview/issues/13
https://stackoverflow.com/questions/23861914/how-to...
1-23 29,560 views
Windows
go build -ldflags -H=windowsgui main.go
https://stackoverflow.com/questions/36727740/how-to-hide-console-window-of-a-go-program-on-windows...