Now we are having problems calling function like C...
# kotlin-native
a
Now we are having problems calling function like C macros from Kotlin. We found some info saying it is not supported. Correct? Do we need to implement normal functions in C or maybe Objective-C that call the macros? The problem is that `cinterop`does not seem to create bindings for the macros.
k
macros are processed by the preprocessor. there are no symbols to create bindings for.
a
Ok, right now we are using OpenSSL from Swift via Objective-C. The macros are "called" from Objective-C that I guess is processed by the preprocessor. How can we do a similar thing from Kotlin/Native? We are trying to port the Objective-C file to Kotlin. I guess that is not possible then? Is the workaround to keep the implementations in Objective-C and bind to Objective-C functions from Kotlin instead?
k
you can either create C/Obj-C equivalents of the necessary macros, or yes, you could create a bridge layer in Obj-C and bind to that
a
Ok, thanks! Will try to create a framework in Xcode that wraps what we need.
s
macros are processed by the preprocessor. there are no symbols to create bindings for.
Actually, we support macros to some degree (constants and pointers). But yeah, if
cinterop
failed to create binding to some macro, the workaround is to create wrapper as it explained here: https://kotlinlang.org/docs/reference/native/c_interop.html#macros
k
interesting