Hey folks! I’m using kotlinc-native to compile a ...
# kotlin-native
i
Hey folks! I’m using kotlinc-native to compile a simple program, no main since it will be loaded externally. If I run
kotlinc-native test.kt -nomain
it fails with
“could not find ‘main’ in ‘<root>’ package.”
Same thing happens until I strictly provide a entry point with -e and the entry point method needs to have either 0 args or an arg array. Is there a way to compile it without having a main method? I thought
-nomain
option does that already but it just turns out ignored 🤔
Copy code
fun run(args: Array<String>, result: Test){
    val array = args
    array[0] = "42"
    result.res(array[0])
}

interface Test {
    fun res(string: String)
}
m
Without a main you are not creating a program. Instead I'm guessing you need to build a library. I don't know how to do that, but that would be what I would start researching.
i
@mkrussel as soon as I read the message I realised what a dumbass I was, I forgot to include “-produce library” 😂 thanks for the solution <3
oh well it goes down the drain since I cant produce a lib for wasm 😢