sdlJoystickGetGuidFromString function

SdlGuid sdlJoystickGetGuidFromString(
  1. String? pchGuid
)

Convert a GUID string into a SDL_JoystickGUID structure.

Performs no error checking. If this function is given a string containing an invalid GUID, the function will silently succeed, but the GUID generated will not be useful.

\param pchGUID string containing an ASCII representation of a GUID \returns a SDL_JoystickGUID structure.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickGetGUIDString

extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID)

Implementation

SdlGuid sdlJoystickGetGuidFromString(String? pchGuid) {
  final sdlJoystickGetGuidFromStringLookupFunction = libSdl2.lookupFunction<
      SdlGuid Function(Pointer<Utf8> pchGuid),
      SdlGuid Function(Pointer<Utf8> pchGuid)>('SDL_JoystickGetGUIDFromString');
  final pchGuidPointer = pchGuid != null ? pchGuid.toNativeUtf8() : nullptr;
  final result = sdlJoystickGetGuidFromStringLookupFunction(pchGuidPointer);
  calloc.free(pchGuidPointer);
  return result;
}