How to properly create bindings for a library that...
# kotlin-native
i
How to properly create bindings for a library that depends on another one? Say I want to create bindings for a library “foo” with a single header foo.h, which in turn includes bar/bar.h. Do I have to tell cinterop where to find all required headers? Or do I have to compile them one by one?
r
Assuming both
foo.h
and
bar/bar.h
are present in include directories (passed via
compilerOpts = -Idir1 -Idir2
in
.def
file) and
bar/bar.h
isn't filtered out via
headerFilter
,
cinterop
should process all of them automatically. So you put
headers = foo.h
in
.def
and both this file and everything included into it gets wrapped into generated bindings.
👍 1
i
Okay, I figured it out - the paths were messed up a bit. Thank you!
💪 1