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} }
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 }