{"id":28236645,"url":"https://github.com/karmakrafts/kwire","last_synced_at":"2026-04-04T22:33:56.612Z","repository":{"id":261989538,"uuid":"864679726","full_name":"karmakrafts/kWire","owner":"karmakrafts","description":"Extending Kotlin/Multiplatform with native programming capabilities.","archived":false,"fork":false,"pushed_at":"2025-08-13T22:09:35.000Z","size":1415,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-03T18:49:43.222Z","etag":null,"topics":["api","compiler","compiler-plugin","ffi","ffi-wrapper","gradle-plugin","interop","kotlin","kotlin-android","kotlin-jvm","kotlin-native","library","native","runtime"],"latest_commit_sha":null,"homepage":"https://git.karmakrafts.dev/kk/kwire","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karmakrafts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-28T21:39:21.000Z","updated_at":"2025-09-15T09:33:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"bbecb0f1-1a27-4096-979e-eac3f1fae27e","html_url":"https://github.com/karmakrafts/kWire","commit_stats":null,"previous_names":["karmakrafts/multiplatform-dlfcn","karmakrafts/kwire"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/karmakrafts/kWire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FkWire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FkWire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FkWire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FkWire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karmakrafts","download_url":"https://codeload.github.com/karmakrafts/kWire/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FkWire/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31416776,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","compiler","compiler-plugin","ffi","ffi-wrapper","gradle-plugin","interop","kotlin","kotlin-android","kotlin-jvm","kotlin-native","library","native","runtime"],"created_at":"2025-05-19T00:15:56.350Z","updated_at":"2026-04-04T22:33:56.584Z","avatar_url":"https://github.com/karmakrafts.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kWire\n\n[![](https://git.karmakrafts.dev/kk/kwire/badges/master/pipeline.svg)](https://git.karmakrafts.dev/kk/kwire/-/pipelines)\n[![](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo.maven.apache.org%2Fmaven2%2Fdev%2Fkarmakrafts%2Fkwire%2Fkwire-runtime%2Fmaven-metadata.xml\n)](https://git.karmakrafts.dev/kk/kwire/-/packages)\n[![](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fdev%2Fkarmakrafts%2Fkwire%2Fkwire-runtime%2Fmaven-metadata.xml\n)](https://git.karmakrafts.dev/kk/kwire/-/packages)\n\nExtending Kotlin/Multiplatform with native programming capabilities.  \nThis library provides features including but not limited to:\n\n* Unmanaged memory API (`Allocator`, `Memory` and `MemoryStack`)\n* Foreign function API for calling native functions by address (`FFI`)\n* Shared library API for loading shared objects (`SharedLibrary`)\n* Native size types (`NInt`, `NUInt` and `NFloat`)\n* Native function types (`CFn\u003cF\u003e`)\n* Type safe pointers with constness (`@Const` and `Ptr`)\n* Calling convention modifiers for function pointers (`@CDecl`, `@ThisCall`, `@StdCall` and `@FastCall`)\n* Structure types (`Struct`)\n* Auto generated memory stack scopes (using `MemoryStack`)\n* Auto generated interop using `@SharedImport`, similar to `DllImport` in C#\n* Basic metaprogramming (`@ValueType` and `typeOf\u003cT\u003e()`)\n* Function templates with monomorphization (`@Template`)\n* Memory access optimizations based on target platform\n* Function call optimizations based on target platform\n* Standalone ABI library for parsing and demangling kWire symbol data\n\n**This library does not support JS/WASM targets, and there is no plans on supporting it in the future.\nIf you know how to do it, feel free to contribute :)**\n\n## How it works\n\n![Architecture Diagram](/docs/architecture.png)\n\n### ABI\n\nThe ABI part of the library is shared between the runtime and compiler plugin.  \nIt implements shared type definitions and mechanisms for properly handling kWire symbols  \nwhich are embedded in the module data of the module being compiled with the kWire compiler plugin.\n\n### Runtime\n\n* On the JVM, the runtime implements/wraps around the Panama API available with Java 21+.  \n  This allows easy interaction with platform-specific JVM code and a lot of opportunity for\n  optimizations which directly tie into the JIT compiler\n\n* On Android, the Panama API is not available out of the box.  \n  For this reason, kWire uses a [port of Project Panama to Android](https://github.com/vova7878/PanamaPort) to substitute the \n  missing standard APIs\n\n* Special features like pinning on the JVM are implemented in the [kWire Platform Binaries](https://git.karmakrafts.dev/kk/prebuilts/kwire-platform)\n  as handwritten JNI intrinsics, since Panama doesn't offer any alternatives.\n\n* On native targets, kWire uses a custom implementation built in Kotlin/Native and using\n  [libffi](https://github.com/libffi/libffi) for dispatching calls at runtime in an efficient manner, giving very acceptable\n  performance to builtin C-function calls in Kotlin/Native\n\n### Compiler Plugin\n\nThe compiler plugin is mainly responsible for lowering code.  \nThis means transforming some higher-level concepts and calls into their actual implementation,\nwhich is usually directly emitted in Kotlin (F)IR.  \n\nThis allows kWire to implement features otherwise not possible due to limitations of the \nKotlin compiler.\n\n### Gradle Plugin\n\nThe Gradle plugin simply exists to inject the compiler plugin into the Kotlin compiler (daemon),  \nhowever it is planned to be extended with code generation capabilities similar to **kotlinx.cinterop**.\n\n## Credits \u0026 Licenses\n\n| Project Name                                                             | License                  | Author            |\n|--------------------------------------------------------------------------|--------------------------|-------------------|\n| [kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines)       | Apache-2.0               | JetBrains         |\n| [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) | Apache-2.0               | JetBrains         |\n| [kotlinx.io](https://github.com/Kotlin/kotlinx.serialization)            | Apache-2.0               | JetBrains         |\n| [AutoService](https://github.com/google/auto/tree/main/service)          | Apache-2.0               | Google            |\n| [Stately](https://github.com/touchlab/Stately)                           | Apache-2.0               | Touchlab          |\n| [LWJGL 3](https://github.com/LWJGL/lwjgl3)                               | BSD-3-Clause             | Ioannis Tsakpinis |\n| [OSHI](https://github.com/oshi/oshi)                                     | MIT                      | Daniel Widdis     |\n| [PanamaPort](https://github.com/vova7878/PanamaPort)                     | GPL2                     | Vladimir Kozelkov |\n| [libffi](https://github.com/libffi/libffi)                               | MIT                      | Anthony Green     |\n| [ANTLR Kotlin](https://github.com/Strumenta/antlr-kotlin)                | Apache-2.0, BSD-3-Clause | Strumenta         |\n\nSpecial thanks to everyone involved in providing the libraries and tools  \nthis project so heavily relies on, and for pouring countless hours of their\ntime into these projects.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmakrafts%2Fkwire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarmakrafts%2Fkwire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmakrafts%2Fkwire/lists"}