stdlib: Add exitProcess function

This commit is contained in:
Ilya Matveev
2017-09-01 19:55:31 +07:00
committed by ilmat192
parent bacb1c21f7
commit ea667ebc5c
4 changed files with 25 additions and 0 deletions
+5
View File
@@ -408,6 +408,11 @@ task array_to_any(type: RunKonanTest) {
source = "codegen/basics/array_to_any.kt"
}
task runtime_basic_exit(type: RunKonanTest) {
source = "runtime/basic/exit.kt"
expectedExitStatus = 42
}
task hello0(type: RunKonanTest) {
goldValue = "Hello, world!\n"
source = "runtime/basic/hello0.kt"
@@ -0,0 +1,5 @@
import kotlin.system.*
fun main(args: Array<String>) {
exitProcess(42)
}
+4
View File
@@ -66,4 +66,8 @@ void Kotlin_interop_free(void* ptr) {
konan::free(ptr);
}
void Kotlin_system_exitProcess(KInt status) {
exit(status);
}
} // extern "C"
@@ -0,0 +1,11 @@
package kotlin.system
/**
* Terminates the currently running process.
* The argument serves as a status code; by convention,
* a nonzero status code indicates abnormal termination.
*
* This method never returns normally.
*/
@SymbolName("Kotlin_system_exitProcess")
public external fun exitProcess(status: Int): Nothing