sdlStringToGuid function guid

SdlGuid sdlStringToGuid(
  1. String? pchGuid
)

Convert a GUID string into a SDL_GUID 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_GUID structure.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GUIDToString

extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID)

Implementation

SdlGuid sdlStringToGuid(String? pchGuid) {
  final sdlStringToGuidLookupFunction = _libSdl
      .lookupFunction<
        SdlGuid Function(Pointer<Utf8> pchGuid),
        SdlGuid Function(Pointer<Utf8> pchGuid)
      >('SDL_StringToGUID');
  final pchGuidPointer = pchGuid != null ? pchGuid.toNativeUtf8() : nullptr;
  final result = sdlStringToGuidLookupFunction(pchGuidPointer);
  calloc.free(pchGuidPointer);
  return result;
}