cgo.wchar
帮助在cgo中使用wchars。
例子
go.hid库中的示例:
func ( dev * Device ) ManufacturerString () ( string , error ) {
// create WcharString
ws := wchar . NewWcharString ( 100 )
// retrieve manufacturer string from hid
res := C . hid_get_manufacturer_string ( dev . hidHandle , ( * C . wchar_t )( ws . Pointer ()), 100 )
if res != 0 {
return "" , dev . lastError ()
}
// get WcharString as Go string
2021-11-19 10:41:32
5KB
Go
1