Adam S
12/09/2023, 10:38 PMlib-alpha
and lib-beta
. To keep things separate, I've got two Gradle subprojects. lib-beta
has #import lib-alpha.h
, which means that CInterop generates duplicate classes.
For example, lib-alpha
contains a Rectangle struct. lib-beta
is supposed to use the same Rectangle, but because the CInterop bindings are generated in a separate subproject, the binding for the same Rectangle is duplicated, and so the Rectangle is incompatible.
Is there a way to tell the CInterop class to re-use an existing generated binding?Timofey Solonin
12/10/2023, 11:29 AMlib-alpha
and pass this klib as a -library
dependency to CInterop for lib-beta
, then lib-beta
will reuse the declarations from lib-alpha.klib
instead of duplicating them.Adam S
12/10/2023, 11:34 AMTimofey Solonin
12/10/2023, 12:02 PM./gradlew :b:compileKotlinMA64
Adam S
12/10/2023, 12:23 PMAdam S
12/10/2023, 12:23 PMAdam S
12/10/2023, 12:24 PMTimofey Solonin
12/10/2023, 12:42 PMthe include dir needs to be exactly the sameThis could be the reason, but most importantly you want the header files to be exactly the same. In the example you could duplicate the
include
directory to be includeA
and includeB
with equal contents and the declaration reuse would still work. But as soon as you would add a newline to a.h
in includeA
the declaration reuse would stop working.Adam S
12/10/2023, 1:15 PMAdam S
12/10/2023, 1:16 PMAdam S
12/10/2023, 1:41 PM