If you have two packages with the same leaf name, e.g. knlibrary.sync and knlibrary.nested.sync, they end up getting combined into one in the generated C header. Was able to reproduce on 1.3.61 and 1.3.70.
sync.kt:
package knlibrary.sync
class PlainSync {}
nested.sync.kt:
package knlibrary.nested.sync
class NestedSync {}
test.cpp:
#include <cstdio>
#define __attribute__(x) // MSVC doesn't support this
#include "knlibrary_api.h"
int main()
{
knlibrary_ExportedSymbols* lib = knlibrary_symbols();
auto knlibrary = lib->kotlin.root.knlibrary;
// So far so good, NestedSync should be in knlibrary.nested.sync
auto good = knlibrary.nested.sync.NestedSync.NestedSync();
// Unexpected! PlainSync should be in knlibrary.sync
auto bad = knlibrary.nested.sync.PlainSync.PlainSync();
return 0;
}
build.cmd:
@echo off
call kotlinc-native -g sync.kt nested.sync.kt -produce dynamic -o knlibrary.dll
lib.exe /def:knlibrary.def /out:knlibrary.lib /machine:x64
cl.exe test.cpp knlibrary.lib
Hi, @alusch! Thank you for the report, we reproduced it successfully. As the cause is not clear for now, I cannot give any ETA's of its fix.
Hi @artdfel! Is there any progress on this one? It'd be great to even know how this ends up happening, so that maybe we can make a local workaround to hold us over until the next release. Thanks!
Sorry, but there was no progress for now. I'll post any updates here as soon as we get it moving.
Fixed in 1.4 (starting from M2).