Support Boolean in interop varargs and function pointers invocation
This commit is contained in:
committed by
SvyatoslavScherbina
parent
571fe47571
commit
99dd7227dc
@@ -70,6 +70,10 @@ private fun invokeImplUnitRet(ptr: COpaquePointer, vararg args: Any?): Unit = me
|
||||
callWithVarargs(ptr.rawValue, nativeNullPtr, FFI_TYPE_KIND_VOID, args, emptyArray(), memScope)
|
||||
}
|
||||
|
||||
@ExportForCompiler
|
||||
private fun invokeImplBooleanRet(ptr: COpaquePointer, vararg args: Any?): Boolean =
|
||||
invokeImplByteRet(ptr, *args).toBoolean()
|
||||
|
||||
@ExportForCompiler
|
||||
private fun invokeImplByteRet(ptr: COpaquePointer, vararg args: Any?): Byte = memScoped {
|
||||
val resultBuffer = allocFfiReturnValueBuffer<ByteVar>(ByteVar)
|
||||
|
||||
@@ -38,6 +38,8 @@ private tailrec fun convertArgument(
|
||||
FFI_TYPE_KIND_SINT64
|
||||
}
|
||||
|
||||
is Boolean -> convertArgument(argument.toByte(), isVariadic, location, additionalPlacement)
|
||||
|
||||
is Byte -> if (isVariadic) {
|
||||
convertArgument(argument.toInt(), isVariadic, location, additionalPlacement)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user