sdlLoadFunction function
Look up the address of the named function in a shared object.
This function pointer is no longer valid after calling SDL_UnloadObject().
This function can only look up C function names. Other languages may have name mangling and intrinsic language support that varies from compiler to compiler.
Make sure you declare your function pointers with the same calling convention as the actual library function. Your code will crash mysteriously if you do not do this.
If the requested function doesn't exist, NULL is returned.
\param handle a valid shared object handle returned by SDL_LoadObject(). \param name the name of the function to look up. \returns a pointer to the function or NULL on failure; call SDL_GetError() for more information.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.1.3.
\sa SDL_LoadObject
extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(SDL_SharedObject *handle, const char *name)
Implementation
Pointer<NativeType> sdlLoadFunction(
Pointer<SdlSharedObject> handle, String? name) {
final sdlLoadFunctionLookupFunction = libSdl3.lookupFunction<
Pointer<NativeType> Function(
Pointer<SdlSharedObject> handle, Pointer<Utf8> name),
Pointer<NativeType> Function(Pointer<SdlSharedObject> handle,
Pointer<Utf8> name)>('SDL_LoadFunction');
final namePointer = name != null ? name.toNativeUtf8() : nullptr;
final result = sdlLoadFunctionLookupFunction(handle, namePointer);
calloc.free(namePointer);
return result;
}