In a c interop, does anyone know why I am getting ...
# kotlin-native
p
In a c interop, does anyone know why I am getting the error:
Unresolved reference: __builtin_va_list
? I am not sure I understand why this error occurs. The generated Kotlin file has this import:
Copy code
import platform.builtin.__builtin_va_list
, but that import does not exist. Does anyone know why this problem occurs or has any workaround for it?
n
There were some changes made to the way C var args are handled in Kotlin Native. What you are seeing could be the result of these changes.
a
Hello, @Patrick! Can you show the code producing it? I remember similar error with some libopengl interop(https://github.com/JetBrains/kotlin-native/issues/3564), but here it seems to be a different case.
p
Hey @Artyom Degtyarev [JB]. This issue happens if I try to import the header files of the duktape js engine (https://duktape.org). I don't think solution linked in the issue works, because those compiler flags just exclude the relevant code from the compilation.
a
One more thing, @Patrick. What platform you were targeting here? I see a
windowsMain
mention, but bitness also might be important here.
p
Windows (WIN32), x86_64 64bit architecture.
a
Unfortunately I was unable to reproduce this error locally. Can you help us a bit more and try to minimize number of headers getting into the compilation? Using
headerFilter
option, begin with including only
duktape.h
and then extend the list of headers on cinterop’s demand.
p
If I put this line in the def file:
Copy code
headerFilter = duktape.h
The compilation works.
Copy code
headerFilter = **
leads to the compilation error
Copy code
Unresolved reference: __builtin_va_list
Thanks for your help :)
🎉 1
Any ideas why this happens? Is there a way to get it to work without commenting out compilations?
a
I’m not sure, but maybe there are cyclical dependencies across those headers. With
=**
you’re adding whatever the parser finds, it’s always better to specify particular headers you need.
p
I see, if I use this line:
Copy code
headerFilter = duktape.h duk_config.h
It fails again
It would be good to know why it fails for this header, in case we need it in the future.