SDL_CreatePr...ithProperties(3)
π SDL_CreateProcessWithProperties π
okay so bestie, welcome to the SDL3 FUNCTIONS section, and today's main character is SDL_CreateProcessWithProperties β she makes you a whole new process and lets you customize everything about it through properties. it's giving build-your-own-adventure but for spawning processes. π¦
β¨ NAME β¨
SDL_CreateProcessWithProperties β create a new process with the specified properties. no cap, that's literally the whole job. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_process.h>
SDL_Process * SDL_CreateProcessWithProperties(SDL_PropertiesID props);
π DESCRIPTION π
so here's the tea β these are the supported properties, and you're gonna wanna know all of them:
SDL_PROP_PROCESS_CREATE_ARGS_POINTERβ an array of strings with the program to run, any arguments, and aNULLpointer at the end. like, for real:
const char *args[] = { "myprogram", "argument", NULL }
This one is a required property, bestie. you cannot skip it, it's not optional, it's the whole vibe. π¨
SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTERβ anSDL_Environmentpointer. if you set this, it becomes the entire environment for the process. if you don't, it just uses the current environment. your choice, your rules. β¨SDL_PROP_PROCESS_CREATE_WORKING_DIRECTORY_STRINGβ a UTF-8 encoded string for the working directory of the process. defaults to the current working directory. she knows where she belongs. πSDL_PROP_PROCESS_CREATE_STDIN_NUMBERβ anSDL_ProcessIOvalue describing where standard input comes from. defaults toSDL_PROCESS_STDIO_NULL.SDL_PROP_PROCESS_CREATE_STDIN_POINTERβ anSDL_IOStreampointer used for standard input whenSDL_PROP_PROCESS_CREATE_STDIN_NUMBERis set toSDL_PROCESS_STDIO_REDIRECT. πSDL_PROP_PROCESS_CREATE_STDOUT_NUMBERβ anSDL_ProcessIOvalue describing where standard output goes to. defaults toSDL_PROCESS_STDIO_INHERITED.SDL_PROP_PROCESS_CREATE_STDOUT_POINTERβ anSDL_IOStreampointer used for standard output whenSDL_PROP_PROCESS_CREATE_STDOUT_NUMBERis set toSDL_PROCESS_STDIO_REDIRECT.SDL_PROP_PROCESS_CREATE_STDERR_NUMBERβ anSDL_ProcessIOvalue describing where standard error goes to. defaults toSDL_PROCESS_STDIO_INHERITED.SDL_PROP_PROCESS_CREATE_STDERR_POINTERβ anSDL_IOStreampointer used for standard error whenSDL_PROP_PROCESS_CREATE_STDERR_NUMBERis set toSDL_PROCESS_STDIO_REDIRECT.SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEANβtrueif the error output of the process should be redirected into the standard output of the process. lowkey important: this property has no effect ifSDL_PROP_PROCESS_CREATE_STDERR_NUMBERis set. so don't set both and get confused, okay? πSDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEANβtrueif the process should run in the background. in that case the default input and output isSDL_PROCESS_STDIO_NULL, and the exitcode of the process is not available β it will always be0. so like, she's ghosting you on the exit code. πSDL_PROP_PROCESS_CREATE_CMDLINE_STRINGβ a string containing the program to run and any parameters. this string is passed directly toCreateProcesson Windows, and does nothing on other platforms. this property is only important if you want to start programs that do non-standard command-line processing, and in most cases usingSDL_PROP_PROCESS_CREATE_ARGS_POINTERis sufficient. iykyk. πͺ
β οΈ POSIX besties, listen up: on POSIX platforms,wait()andwaitpid(-1, ...)should not be called, andSIGCHLDshould not be ignored or handled β because those would prevent SDL from properly tracking the lifetime of the underlying process. you should useSDL_WaitProcess()instead. fr fr, don't fight the framework. π
π«Ά FUNCTION PARAMETERS π«Ά
propsβ the properties to use. that's it, that's the whole input. π
β RETURN VALUE β
Returns the newly created and running process β or NULL if the process couldn't be created. so check your pointer, bestie, she might not have made it. π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. go off, queen. π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on something older, no she's not there yet, upgrade babes. π
π₯ SEE ALSO π₯
SDL_CreateProcess(3)SDL_GetProcessProperties(3)SDL_ReadProcess(3)SDL_GetProcessInput(3)SDL_GetProcessOutput(3)SDL_KillProcess(3)SDL_WaitProcess(3)SDL_DestroyProcess(3)
and that's the whole page, bestie!! π this one came to you from Simple Directmedia Layer, running SDL 3.4.18, and it's filed under SDL_CreatePr...ithProperties(3) in case you need to find her again. slay, stay safe, and always check for NULL before you dereference. mwah πβ¨π¦
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms