sdlStringToGuid function
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.
\since This function is available since SDL 3.1.3.
\sa SDL_GUIDToString
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID)
Implementation
SdlGuid sdlStringToGuid(String? pchGuid) {
final sdlStringToGuidLookupFunction = libSdl3.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;
}