mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-02 12:50:55 +00:00
ffi: ensure failure to find functions don't produce null pointer exceptions
This commit is contained in:
parent
a9e3e8a69a
commit
ca111f8e4b
@ -10,6 +10,7 @@ class JnaNativeProvider : NativeProvider {
|
|||||||
override fun provideNativeFunction(definition: String, arguments: List<ArgumentSpec>): CallableFunction {
|
override fun provideNativeFunction(definition: String, arguments: List<ArgumentSpec>): CallableFunction {
|
||||||
val functionDefinition = FfiFunctionDefinition.parse(definition)
|
val functionDefinition = FfiFunctionDefinition.parse(definition)
|
||||||
val function = Function.getFunction(functionDefinition.library, functionDefinition.function)
|
val function = Function.getFunction(functionDefinition.library, functionDefinition.function)
|
||||||
|
?: throw RuntimeException("Failed to find function ${functionDefinition.function} in library ${functionDefinition.library}")
|
||||||
return CallableFunction { functionArgs ->
|
return CallableFunction { functionArgs ->
|
||||||
val ffiArgs = mutableListOf<Any?>()
|
val ffiArgs = mutableListOf<Any?>()
|
||||||
for ((index, spec) in arguments.withIndex()) {
|
for ((index, spec) in arguments.withIndex()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user