tdlib-kmp
Kotlin Multiplatform library wrapping TDLib (Telegram Database Library).
Architecture inspired by JetBrains/skiko.
Supported platforms
| Platform | Target | Linking |
|---|
| Android | arm64-v8a, armeabi-v7a, x86, x86_64 | JNI shared (libtdjsonjava.so) |
| JVM | Windows x64/arm64, Linux x64/arm64, macOS x64/arm64 | JNI shared (fat JAR, extracted at runtime) |
| iOS | arm64, simulatorArm64 | cinterop + static |
| macOS | arm64, x64 | cinterop + static |
| Linux | x64, arm64 |
Project structure
Usage
dependencies {
implementation("io.github.xephosbot:tdlib-kmp:<version>")
}
import io.xbot.tdlib.TdLib
val clientId = TdLib.createClientId()
TdLib.send(clientId, """{"@type":"getOption","name":"version"}""")
val response = TdLib.receive(10.0)
val syncResult = TdLib.execute("""{"@type":"getOption","name":"version"}""")
Building
./gradlew :tdlib:build
Extracted artifacts are cached in prebuilds/natives/ at the project root and survive
./gradlew clean. Download archives are placed in build/downloads/ and are wiped by
clean — they will be re-fetched if prebuilds/natives/ is missing.
TDLib version
Current: 1.8.62 (from xephosbot/td-pack)