sdlIconvOpen function

Pointer<SdlIconvT> sdlIconvOpen(
  1. String? tocode,
  2. String? fromcode
)
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode)

Implementation

Pointer<SdlIconvT> sdlIconvOpen(String? tocode, String? fromcode) {
  final sdlIconvOpenLookupFunction = libSdl2.lookupFunction<
      Pointer<SdlIconvT> Function(Pointer<Utf8> tocode, Pointer<Utf8> fromcode),
      Pointer<SdlIconvT> Function(
          Pointer<Utf8> tocode, Pointer<Utf8> fromcode)>('SDL_iconv_open');
  final tocodePointer = tocode != null ? tocode.toNativeUtf8() : nullptr;
  final fromcodePointer = fromcode != null ? fromcode.toNativeUtf8() : nullptr;
  final result = sdlIconvOpenLookupFunction(tocodePointer, fromcodePointer);
  calloc.free(tocodePointer);
  calloc.free(fromcodePointer);
  return result;
}