SDL_wcsdup(3)

✨ SDL_wcsdup ✨

okay bestie, welcome to the SDL_wcsdup page πŸ’– it's a little guy from the SDL3 FUNCTIONS crew and honestly? it's giving "small but mighty."


πŸŽ€ NAME πŸŽ€

SDL_wcsdup β€” Allocate a copy of a wide string. fr fr, that's the whole job. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

wchar_t * SDL_wcsdup(const wchar_t *wstr);

that's it. that's the whole vibe. one header, one function, one wchar_t * coming back at you πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

so here's the tea: this allocates enough space for a null-terminated copy of wstr, using SDL_malloc, and then makes a copy of the string into this space. like a photocopier but for wide strings, no cap πŸ“‹βœ¨

the returned string is owned by the caller, and should be passed to SDL_free when no longer needed. so yeah β€” you made it, you clean it up. main character energy comes with responsibilities, babe πŸ‘‘

not me stressing this enough: you must hand it to SDL_free when you're done with it. don't just walk away from it, that's how leaks happen and leaks are NOT the vibe πŸ’€

🧚 FUNCTION PARAMETERS 🧚

  • wstr β€” the string to copy. the little OG. the source material. we stan 🌈

🫢 RETURN VALUE 🫢

Returns a pointer to the newly-allocated wide string. brand new, fresh out of SDL_malloc, ready to be your bestie πŸ’œ


🌟 THREAD SAFETY 🌟

It is safe to call this function from any thread. yes bestie, ANY thread. she's flexible like that. go off πŸ‘‘


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older, sorry babes, upgrade time 😭


πŸ¦‹ SEE YOU LATER πŸ¦‹

that's the whole page, no skips, no cuts πŸ’… big love to the Simple Directmedia Layer girlies for making it happen β€” this one's living in the SDL 3.4.18 era, and honestly? iconic. go SDL_free your strings, drink water, and stay slay πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from