Sorry for spamming this channel, but could you ple...
# webassembly
a
Sorry for spamming this channel, but could you please provide more information on whether Long & ULong are already compiled correctly? I tried to add a parameter with such type to an exported function, but this leads to the following: • JS-related warning is emitted:
Exported declaration uses non-exportable parameter type: ULong
-> seems to be ignorable • .wat file no longer exists • WASM Instance can be instantiated in nodeJs & function called for Long -> for ULong, WASM Instance can not be instantiated due to
Compiling function #656:"fibonacci__JsExportAdapter" failed: type error in branch[0] (expected structref, got i64) @+55427
(function signature looks like
fun fibonacci(n: ULong, a: ULong, b: ULong): ULong
) Also, if I try to add a default value for the parameters
a
&
b
in the ULong case, I get another error:
Duplicate export name 'fibonacci' for function 656 and function 657 @+14021
... Any ideas?
s
Try maybe with
Long
instead of
ULong
for imports/exports.
a
• WASM Instance can be instantiated in nodeJs & function called for Long
Thank you, that's what worked - though the .wat file is still missing. However, the question remains what is going wrong in the ULong case...
s
Yeah, you will probably need to wait Kotlin/Wasm team feedback on that one
b
There is a compiler option to turn on wat genration
-Xwasm-generate-wat
Add into your build.gradle.kts something like:
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile>().configureEach {
    kotlinOptions.freeCompilerArgs += listOf(
        "-Xwasm-generate-wat", 
    )
}