Cgo.wchar
The cgo.wchar package is to be used with go/cgo and helps with the conversion from and to C.wchar_t and wchar_t strings (*C.wchar_t with null terminator or length int).
Install / Use
/learn @GeertJohan/Cgo.wcharREADME
cgo.wchar
Helps with using wchars with cgo.
Example
Example from the go.hid library:
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
str := ws.GoString()
// all done
return str, nil
}
Related Skills
node-connect
340.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.1kCommit, push, and open a PR
