/*
#include <stdio.h>
#include <library.h>
#include <dic32.h>
//包含header的目录
#cgo CFLAGS: -I/home/leen/header
//-L指定所在目录,支持绝对、相对路径,-l指定类库名称(去掉前面的lib及后面的.so,如libUsbKey.so为-lUsbKey)
//静态库方式(后缀名为.a),编译时库内容会内嵌在最终程序中,执行环境不在需要依赖库(.a)
//#cgo LDFLAGS: -L/home/leen/lib -lUsbKey -lRockey6SmartPlus
//动态库方式(后缀名为.so),编译时只做链接,不包含在程序中,执行环境lib目录下需要包含同样的依赖库(.so)
#cgo LDFLAGS: -L./ -lUsbKey -lRockey6SmartPlus -Wl,-rpath=./
*/
import "C"// 切勿换行再写这个
import (
"fmt"
"strings"
)
func main() {
//上述c代码中采用动态库方式,静态库已注释,采用静态库方式编译亦可以
value := C.GoString(C.readUsbKey())
fmt.Println(strings.TrimSpace(value))
}