Posted to tcl by schelte at Tue Oct 25 22:47:52 GMT 2022view raw
- I'm trying to use hidapi (https://github.com/libusb/hidapi) via cffi.
- Because wchar_t has a different size on linux and windows, I tried to use a type alias. But I get an error:
- package require cffi
- if {$tcl_platform(platform) eq "windows"} {
- set dll hidapi.dll
- cffi::alias define wchar_t ushort
- } else {
- set dll libhidapi-hidraw.so
- cffi::alias define wchar_t uint
- }
- cffi::Wrapper create hidapi [file join $dir $dll]
- hidapi function hid_get_product_string {int zero} {
- dev pointer.hid_device
- wstr {wchar_t[nchars] retval}
- nchars {size_t {default 256}}
- }
- Invalid value "wchar_t[nchars]". Invalid base type. Error defining function hid_get_product_string.