[KotlinPoet] Is it possible to add explicit wildst...
# squarelibraries
b
[KotlinPoet] Is it possible to add explicit wildstar imports to a generated file? I'm working with c imports and have no way to distinguish where a known type comes from, but I know that one of the given packages will have it.
v
I haven't found a way to do it directly using KotlinPoet but the problem sounds familiar. Are you having this issue because of cinterop-mapped enums by any chance?
b
Not just enums, cinterop stuff in general
Seems like I'll have to use stub package during generation and then just manually replace all imports from there with my set of wildcards via raw string manipulation.
As in rewrite generated files
v
for enums you can get around it by using the
strictEnums
in the def file, this will skip the barely documented heuristics for determining how enums are mapped
I have not encountered any other cases where the package was not clearly known post-cinterop
I'm interested in any other cases you encounter since I might need to solve a similar thing soon. Which C library are you generating bindings for?
b
I'm parsing gir and generating oo wrappers over cinterop. Haven't progressed too far with actual generation just yet as I've been focusing on gir parsing for now, but trying to resolve my open questions before I'm blocked by them 😀
v
Then we are likely working on the same thing so I'd love to trade experiences. We have PoC code going from .gir to Gtk windows showing on the screen without manual intervention and are currently rewriting the parser/generator in a clean repository.
so far the enum thing is the only thing I've had some issues with, but it is fixed by adding the enumerations from gir to the .def file before generating the cinterop bindings.