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 a NULL pointer 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 β€” an SDL_Environment pointer. 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 β€” an SDL_ProcessIO value describing where standard input comes from. defaults to SDL_PROCESS_STDIO_NULL.
  • SDL_PROP_PROCESS_CREATE_STDIN_POINTER β€” an SDL_IOStream pointer used for standard input when SDL_PROP_PROCESS_CREATE_STDIN_NUMBER is set to SDL_PROCESS_STDIO_REDIRECT. πŸ”€
  • SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER β€” an SDL_ProcessIO value describing where standard output goes to. defaults to SDL_PROCESS_STDIO_INHERITED.
  • SDL_PROP_PROCESS_CREATE_STDOUT_POINTER β€” an SDL_IOStream pointer used for standard output when SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER is set to SDL_PROCESS_STDIO_REDIRECT.
  • SDL_PROP_PROCESS_CREATE_STDERR_NUMBER β€” an SDL_ProcessIO value describing where standard error goes to. defaults to SDL_PROCESS_STDIO_INHERITED.
  • SDL_PROP_PROCESS_CREATE_STDERR_POINTER β€” an SDL_IOStream pointer used for standard error when SDL_PROP_PROCESS_CREATE_STDERR_NUMBER is set to SDL_PROCESS_STDIO_REDIRECT.
  • SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN β€” true if the error output of the process should be redirected into the standard output of the process. lowkey important: this property has no effect if SDL_PROP_PROCESS_CREATE_STDERR_NUMBER is set. so don't set both and get confused, okay? πŸ™ˆ
  • SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN β€” true if the process should run in the background. in that case the default input and output is SDL_PROCESS_STDIO_NULL, and the exitcode of the process is not available β€” it will always be 0. 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 to CreateProcess on 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 using SDL_PROP_PROCESS_CREATE_ARGS_POINTER is sufficient. iykyk. πŸͺŸ
⚠️ POSIX besties, listen up: on POSIX platforms, wait() and waitpid(-1, ...) should not be called, and SIGCHLD should not be ignored or handled β€” because those would prevent SDL from properly tracking the lifetime of the underlying process. you should use SDL_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 πŸ”₯


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