I've got this:
Code:
PAW_SHARED struct paw_app* paw_boot_app( void *ud, char const * const path, char *argv[], char *envp[] )
{
#ifdef PAW_WIN32
/* Not supported yet */
return NULL;
#else
int pid = fork();
if ( pid == 0 )
(void)execve( path, argv, envp );
/* According to docs the new app will take over the pid and replace
* our address space with it's own as it initiates, we therefore
* should assume that if execve returned we failed to launch the app,
* either way we do not want the child to return a valid object for
* itself or the root system process which is probably the kernel and
* not what any normal user will want to use, anyone that does want to
* use it will not use such a convoluded method as going through this
* function unless they just want to see what happens, in which case
* they will have downloaded the project, modified it and compiled that
* copy instead */
else if ( pid > 0 )
/* Instead of duplicating code let's just pass the pid to one that
* assumes it already exists */
return paw_load_app( ud, pid );
return NULL;
#endif
}
But I'm struggling to find the right way to do it on Win32, also is this the correct way for linux etc?