Another thing with unsigned types – cinterop now g...
# kotlin-native
t
Another thing with unsigned types – cinterop now generates a mix of Int and UInt constants:
Copy code
...
const val WS_OVERLAPPEDWINDOW: Int = 13565952
const val WS_POPUP: UInt = -2147483648.toUInt()
...
...which is a bit cumbersome to use. Is there a good way to pass a list of arguments to a function where each argument can be either Int or UInt? Or can cinterop be improved for these cases?
s
const val WS_OVERLAPPEDWINDOW
is special: you can pass it to interop function expecting
UInt
. Does it solve the problem? There is also an explicit way to convert between integer types, see
convert
function here: https://github.com/JetBrains/kotlin-native/blob/master/INTEROP.md#portability
t
You mean passing it to
CreateWindowExW
? But that's the case with all the
WS_*
constants, most of which are still
Int
.
t
Ah. Yes, that's the real problem – I can pass e.g.
WS_MINIMIZE
or
WS_OVERLAPPED
but not
WS_MINIMIZE or WS_OVERLAPPED
.
...but also the fact that the constants are of mixed types. In my actual program, I do
WS_POPUP or WS_BORDER or ...
which doesn't work anymore without first converting either
WS_POPUP
or all the other flags.