-
Notifications
You must be signed in to change notification settings - Fork 19
Description
In v0.24.1 for #59 (f1f42c1) the library loading was changed to use SymbolLookup.loaderLookup()
as fallback if SymbolLookup.libraryLookup(library, ...)
fails.
The disadvantage is that when users don't actually want to use SymbolLookup.loaderLookup()
, the library loading silently fails and afterwards they encounter cryptic "UnsatisfiedLinkError: unresolved symbol: ts_..." errors.
(probably related: #80)
Now that #61 added support for custom library loading, would it make sense to make usage of SymbolLookup.loaderLookup()
a deliberate opt-in decision of the user, by implementing a NativeLibraryLookup
? For example:
public class LoaderLibLookup implements NativeLibraryLookup {
@Override
public SymbolLookup get(Arena arena) {
return SymbolLookup.loaderLookup();
}
}
Then for all users who don't want to rely on this, if no NativeLibraryLookup
implementation has been registered and SymbolLookup.libraryLookup(...)
fails, library loading could fail fast.
In that case the package-info.java
documentation would have to be updated again, mentioning this possibility to use SymbolLookup.loaderLookup()
with NativeLibraryLookup
.
This is just an idea though; the disadvantage would be that for users who do want to use SymbolLookup.loaderLookup()
it would be a bit more cumbersome.