There is a situation where I am stuck. With the li...
# kotlin-native
There is a situation where I am stuck. With the libssh library I am trying to use the sftp_open function ( ), however the last function parameter (mode) seems to be expecting an octal literal (not entirely sure) which Kotlin doesn't support. Also the last function parameter involves doing a bit of bit banging (eg
mode & ~umask
). It isn't clear how to do this with Kotlin since it doesn't provide any bit manipulation operators. Below is the binding for the function:
Copy code
@kotlinx.cinterop.internal.CCall public external fun sftp_open(session: libssh.sftp_session? /* = kotlinx.cinterop.CPointer<libssh.sftp_session_struct>? */, @kotlinx.cinterop.internal.CCall.CString file: kotlin.String?, accesstype: <http://kotlin.Int|kotlin.Int>, mode: libssh.mode_t /* = kotlin.UInt */): libssh.sftp_file? /* = kotlinx.cinterop.CPointer<libssh.sftp_file_struct>? */ { /* compiled code */ }
Octal literals are syntax only and AFAIK have no representation in C... everything is converted to integers, so they shouldn't be required. About bit manipulations, these are implemented as functions in Kotlin, (e.g.
­čĹŹ 1
would be flip