Example #1
0
func OpenDevice(name string) *Device {
	// TODO: turn empty string into nil?
	// TODO: what about an error return?
	p := C.CString(name)
	h := C.walcOpenDevice(p)
	C.free(unsafe.Pointer(p))
	return &Device{h}
}
Example #2
0
func OpenDevice(name string) (device *Device) {
	p := C.CString(name)
	h := C.walcOpenDevice(p)
	C.free(unsafe.Pointer(p))

	if h == nil {
		return
	}

	device = new(Device)
	device.handle = h
	return
}