[SDL] One SDL app forking to start another
Francesco Orsenigo
xarvh at lombardiacom.it
Wed Aug 28 01:38:01 PDT 2002
Eric Nielson:
> > I have one SDL application that forks and calls execve to start a
> > second SDL application, but the call to SDL_Init in the second
> > application fails.
> > How can I cut all the SDL ties between the two apps, or even better
> > start the second app as a completely different process? (This is on
> > Linux 2.2)
As soon as the program starts, create a pipe pair, then fork() your program.
Parent inits SDL, child wait.
When you need it, parent can write() a command to child() that will either
init SDL and start the application or fork() itself, so that it will remain
available for another fork() while its child starts the app.
Of course, this adds some overhead (the child process), but not so much.
Regards,
Francesco Orsenigo, Xarvh Project
http://freeweb.lombardiacom.it/xarvh/
More information about the SDL
mailing list