Im binding against a library that is importing Fou...
# kotlin-native
a
Im binding against a library that is importing Foundation/Foundation.h using cinterop. Should I point out some system path to make this work? Im thinking in includeDirs in the gradle file.
k
you should use header filters
system headers are already supported
a
Ok so just filter out the headers and it should work?
k
yep
hopefully the relevant header files have some kind of prefix or something you can use (to include them)
a
Hmm, I don't think this was my issue after all. I'm getting this error:
Copy code
> Task :shared:cinteropObjektiveSSLIos FAILED
1 actionable task: 1 executed
Exception in thread "main" java.lang.Error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:492:1: error: expected identifier or '('
	at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
	at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:1003)
	at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:992)
	at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:91)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:230)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:46)
	at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:44)
	at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:19)
	at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:37)

FAILURE: Build failed with an exception.
k
same fix either way 🙂
a
Line 492 is: @class NSString, Protocol;
Is it?
k
yeah, you don't need it to process those files
a
I have two def files:
Copy code
headers = openssl/asn1.h openssl/err.h openssl/pkcs12.h openssl/rsa.h openssl/x509.h
headerFilter = openssl/**
and
Copy code
headers = ObjektiveSSL/ObjektiveSSL.h
headerFilter = ObjektiveSSL/** openssl/**
So why is it not fitlering?
k
that's a good question
your filters are correct afaik
a
Hmm ok. Any idea how to debug this?