{"id":13341530,"url":"https://github.com/NOctu1412/AxionEngine","last_synced_at":"2025-03-11T22:31:00.741Z","repository":{"id":176504648,"uuid":"658097206","full_name":"NOctu1412/AxionEngine","owner":"NOctu1412","description":"Kotlin library for high level playing with the at WASM runtime.","archived":false,"fork":false,"pushed_at":"2023-06-26T18:07:46.000Z","size":11122,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-24T10:06:16.737Z","etag":null,"topics":["interop","java","jvm","kotlin","runtime","wasm","web-assembly"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NOctu1412.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-06-24T18:55:58.000Z","updated_at":"2024-02-19T17:18:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"da8c9f9b-4e0e-4008-9dfc-8020cb803303","html_url":"https://github.com/NOctu1412/AxionEngine","commit_stats":null,"previous_names":["noctu1412/axionengine"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NOctu1412%2FAxionEngine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NOctu1412%2FAxionEngine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NOctu1412%2FAxionEngine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NOctu1412%2FAxionEngine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NOctu1412","download_url":"https://codeload.github.com/NOctu1412/AxionEngine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243125065,"owners_count":20240263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["interop","java","jvm","kotlin","runtime","wasm","web-assembly"],"created_at":"2024-07-29T19:25:29.059Z","updated_at":"2025-03-11T22:31:00.733Z","avatar_url":"https://github.com/NOctu1412.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Axion Engine\n\nThis library is used to get a good interopability between Kotlin and WebAssembly (especially with Rust but I think you can port the [wasm_utils.rs](https://github.com/NOctu1412/AxionEngine/blob/master/rust_example/src/wasm_utils.rs) to other languages).\n\n\n\n\n## Features\n\n- Loading WASM modules into Kotlin\n- Calling WASM exports function with Kotlin types\n- WASM Imports for calling Kotlin from WASM\n- Support for all primitive types + structures\n- Cross platform\n\n\n## Usage/Examples\nRust:\n\n```rust\nmod wasm_utils;\n\nuse wasm_utils::*;\n\nextern \"C\" {\n    pub fn kotlin_print(str: *mut String);\n}\n\n#[no_mangle]\npub unsafe fn test(x: [i64; 4]) -\u003e f32 {\n    kotlin_print(into_mut_ptr(\"Hello from Rust !\".to_string()));\n    x.len() as f32\n}\n```\n\nKotlin:\n```kotlin\nclass KotlinPrintImport : WasmImport(\n    \"kotlin_print\",\n    EnumWasmType.VOID,             //return type\n    arrayOf(EnumWasmType.STRING),  //args types\n    { axionEngine, args -\u003e         //callback\n        val firstArgument = args[0].value as String\n\n        println(firstArgument)\n\n        null                        //for void functions, returning null is good\n    }\n)\n\nfun main() {\n    val wasmBin = File(\"rust.wasm\").readBytes()\n\n    val axionEngine = AxionEngine(wasmBin,\n        KotlinPrintImport(),\n        //...  (add all your imports)\n    )\n\n    val callResult = axionEngine.callExport\u003cFloatWasmType\u003e  //for void functions, do not put a type\n        (\n        \"test\",  //function name\n        listOf(1L, 2L, 3L, 4L).toWasmType(axionEngine),\n        //...   (add all your arguments)\n        )\n\n    println(callResult.value)\n}\n```\n\n(see more examples in the [kotlin test directory](https://github.com/NOctu1412/AxionEngine/tree/master/src/test/kotlin) and in the [rust example](https://github.com/NOctu1412/AxionEngine/tree/master/rust_example))\n\n\n\n\n\n## Authors\n\n- [@NOctu1412](https://www.github.com/NOctu1412)\n\n## Thanks to\n- [@wasmerio](https://www.github.com/wasmerio) for the [wasmer](https://github.com/wasmerio/wasmer) and [wasmer-java](https://github.com/wasmerio/wasmer-java) librairies !\n\n- [@beaclnd92](https://github.com/beaclnd92) for his wasmer-java [pull request](https://github.com/wasmerio/wasmer-java/pull/64)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNOctu1412%2FAxionEngine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNOctu1412%2FAxionEngine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNOctu1412%2FAxionEngine/lists"}