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
mkrussel
10/28/2021, 1:55 PM
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
ianrumac
10/28/2021, 2:25 PM
@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
ianrumac
10/28/2021, 2:29 PM
oh well it goes down the drain since I cant produce a lib for wasm 😢