sdlGetMemoryFunctions function stdinc

Get the current set of SDL memory functions.

\param malloc_func filled with malloc function. \param calloc_func filled with calloc function. \param realloc_func filled with realloc function. \param free_func filled with free function.

\threadsafety This does not hold a lock, so do not call this in the unlikely event of a background thread calling SDL_SetMemoryFunctions simultaneously.

\since This function is available since SDL 3.2.0.

\sa SDL_SetMemoryFunctions \sa SDL_GetOriginalMemoryFunctions

extern SDL_DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, SDL_realloc_func *realloc_func, SDL_free_func *free_func)

Implementation

void sdlGetMemoryFunctions(
  Pointer<Pointer<NativeFunction<SdlMallocFunc>>> mallocFunc,
  Pointer<Pointer<NativeFunction<SdlCallocFunc>>> callocFunc,
  Pointer<Pointer<NativeFunction<SdlReallocFunc>>> reallocFunc,
  Pointer<Pointer<NativeFunction<SdlFreeFunc>>> freeFunc,
) {
  final sdlGetMemoryFunctionsLookupFunction = _libSdl
      .lookupFunction<
        Void Function(
          Pointer<Pointer<NativeFunction<SdlMallocFunc>>> mallocFunc,
          Pointer<Pointer<NativeFunction<SdlCallocFunc>>> callocFunc,
          Pointer<Pointer<NativeFunction<SdlReallocFunc>>> reallocFunc,
          Pointer<Pointer<NativeFunction<SdlFreeFunc>>> freeFunc,
        ),
        void Function(
          Pointer<Pointer<NativeFunction<SdlMallocFunc>>> mallocFunc,
          Pointer<Pointer<NativeFunction<SdlCallocFunc>>> callocFunc,
          Pointer<Pointer<NativeFunction<SdlReallocFunc>>> reallocFunc,
          Pointer<Pointer<NativeFunction<SdlFreeFunc>>> freeFunc,
        )
      >('SDL_GetMemoryFunctions');
  return sdlGetMemoryFunctionsLookupFunction(
    mallocFunc,
    callocFunc,
    reallocFunc,
    freeFunc,
  );
}