nwh
06/29/2018, 8:27 PMolonho
06/29/2018, 8:43 PMnwh
06/29/2018, 9:36 PMolonho
06/30/2018, 4:06 PMpackage = ddk
depends = posix windows
headers = wtypes.h minwindef.h cfgmgr32.h hidclass.h hidusage.h hidpi.h hidsdi.h
compilerOpts = -DUNICODE -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DWINAPI_FAMILY=3 -DOEMRESOURCE \
-Wno-incompatible-pointer-types -Wno-deprecated-declarations
linkerOpts = -lhid
then cinterop -def ddk.def -o ddk
and sample like ddk_test.kt
import ddk.*
import platform.posix.GUID
import kotlinx.cinterop.*
fun main(args: Array<String>) = memScoped {
val guid = alloc<GUID>()
HidD_GetHidGuid(guid.ptr)
println(guid)
}
then konanc ddk_test.kt -l ddk
will produce an executable able to work with HID devices. If some declarations are not present - find them and add to headers
section of the .def file.nwh
07/04/2018, 7:07 PM$ ./program.exe
NativePointed(raw=0x1730a8)
Is this simply the output from the native call? via https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/hidsdi/nf-hidsdi-hidd_gethidguid