Hello! I have a native library I wrote and I am tr...
# getting-started
k
Hello! I have a native library I wrote and I am trying to use JEP 434 to access it. The library is loaded using
System.load
. But the call to
Linker.nativeLinker().defaultLookup().find("my_method_name")
returns
NoSuchElementException
. Shouldn't this return the address of the library I wrote? I am sure that the library is loaded correctly before I use any method of
java.lang.foreign
.
o
You should also use `loaderLookup`:
Copy code
SymbolLookup.loaderLookup().or(Linker.nativeLinker().defaultLookup()).find("my_method_name")
Linker.nativeLinker().defaultLookup()
will use only
system-wide
available libraries while
loaderLookup
will also use libraries loaded via
System.load
during lookup
1
And the question is more about JDK, rather then Kotlin 🙂
true story 1
k
Is there a better better channel for this? Or should I use another slack instance specific for JDK questions?
o
TBH, I don't know about
kotlinlang
analog for Java/JDK I believe it's fine to discuss such questions if they are somehow Kotlin related