Hm, after reading a little more of documentation, ...
# kotlin-native
o
Hm, after reading a little more of documentation, I found that with interop like this we always need to call
"String".cstr.ptr
to be able to pass it to C functions. But still even such code will not work:
Copy code
OSSL_PARAM_construct_utf8_string("digest", hashAlgorithm.cstr.ptr, 0).ptr
I’ve tried to pin
"digest"
string, but this also doesn’t work And only when Im almost surrendered I saw this:
noStringConversion
- https://kotlinlang.org/docs/native-c-interop.html#strings I’ve tried and surprisingly this works. Call now looks like this (even so it’s
const char*
in C, now we need to path pointers all time instead os strings in such calls)
Copy code
OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0).ptr
Im not an expert in C and cinterop, but for me it looks like a bug in cinterop generated bindings under the hood. Should I fill an issue, or is it expected behaviour?