Пример #1
0
func scan(tryhard bool, stride int, pixels []uint8) ([]string, error) {
	outputs := make([]*C.char, 8)
	count, e := C.scan(
		C.bool(tryhard),
		C.int(stride),
		C.int(len(pixels)),
		(*C.char)(unsafe.Pointer(&pixels[0])),
		C.int(len(outputs)),
		&outputs[0],
	)

	if e != nil {
		return nil, e
	}

	results := make([]string, 0, count)
	for i := 0; i < int(count); i++ {
		str := C.GoString(outputs[i])
		results = append(results, str)

		C.free(unsafe.Pointer(outputs[i]))
	}

	return results, nil
}
Пример #2
0
func Scan() {
	C.scan()
}