I'm not sure what I'm missing but I can't seem to ...
# kotlin-native
r
I'm not sure what I'm missing but I can't seem to use outside libraries in kotlin native. I also can't find any gradle documentation that would let me use that, nor any examples that use kotlin gradle scripts to interop with an outside library.
m
C libraries?
r
Yes, specifically ncurses. Not sure what exactly to put in the gradle script. CLion has me using kotlin gradle scripts and won't let me use the regular gradle scripts that all the examples ive seen use. There's not much documentation on kotlin gradle scripts for me to find any information to help me.
d
I agree that documentation for build scripts is sparse and somewhat confusing at the moment. For example, MPP CInterop support link by Mike uses
defFile(project.file("def-file.def"))
which is not used by any examples in kotlin/native
samples
folder.
@RayeW47 I created a simple interop file with just
headers = ncurses.h
and used
cinterop
command to check the kotlin code produced from the header (on OSX). It seems that from around K/N version 1.1.2 cinterop stopped generating code for
ncurses
. I suspect this is some kind of optmisation probably because
ncurses
on system path is already bundled with K/N on osx in
platform.darwin
.
When I change
.def
file to have non-default path, e.g.
headers = /usr/local/Cellar/ncurses/6.1/include/ncurses.h
kotlin code for ncurses is generated as expected.
So it look like everything is working but UX is bad. Even with
-verbose
option
cinterop
doesn’t say anything 😢