- extract common part for easier demo introducing.
- fixed warning [-Wincompatible-pointer-types]
- demo-types
- this debug info generated for pseudo structure:
1 /* smth here... */
2 A {
3 int a;
4 int b;
5}
0:b-debugger-types:minamoto@unit-703(0)# llvmDebugInfoC/build/exe/demotypes/demotypes
define i32 @main() !dbg !3 {
entry:
ret i32 42
}
!llvm.dbg.cu = !{!0}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "konanc", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "<stdin>", directory: "")
!2 = !{}
!3 = distinct !DISubprogram(name: "main", linkageName: "main", scope: null, file: !1, line: 1, type: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, variables: !2)
!4 = !DISubroutineType(types: !5)
!5 = !{!6}
!6 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !1, line: 2, size: 64, align: 32, elements: !7)
!7 = !{!8, !10}
!8 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !6, file: !1, line: 3, baseType: !9, size: 32, align: 32)
!9 = !DIBasicType(name: "int", size: 32, align: 4)
!10 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !6, file: !1, line: 4, baseType: !9, size: 32, align: 32, offset: 32)
Kotlin/Native
Kotlin/Native is a LLVM backend for the Kotlin compiler, runtime implementation and native code generation facility using LLVM toolchain.
Kotlin/Native is primarily designed to allow compilation for platforms where virtual machines are not desirable or possible (such as iOS, embedded targets), or where developer is willing to produce reasonably-sized self-contained program without need to ship an additional execution runtime.
To compile from sources use following steps.
First download dependencies:
./gradlew dependencies:update
Then build the compiler and standard library:
./gradlew dist
To build standard library for cross-targets (currently, iOS on Mac OSX and Raspberry Pi on Linux hosts) use:
./gradlew cross_dist
After that you should be able to compile your programs like that:
export PATH=./dist/bin:$PATH
kotlinc hello.kt -o hello
For an optimized compilation use -opt:
kotlinc hello.kt -o hello -opt
For some tests, use:
./gradlew backend.native:tests:run
To generate interoperability stubs create library definition file
(take a look on samples/tetris/sdl.def) and run cinterop tool like this:
cinterop -def lib.def
See provided samples and INTEROP.md for more details.