El Mar 28 Mar 2006 13:40, Hans Mårtensson escribió: > In good old days the Turbo Pascal had an EXEC procedure that could > execute another program by invoking the DOS command interpreter.
I think that function is in the DOS unit. And it even works in Linux! > > In better new days the FPC does not seem to have such an option, or I > couldn’t find it in the docs. > Now I am particularly interested in doing such a thing in a Linux system. > > I have found in the unix unit a function FPEXECV(path, pp) that may be > used for it, but it leaves a few questions to me. > > According to the docs the function does not return (if it succeeds). Is > there no way of calling another program and then continue the calling > program? Could it be done by starting a new thread, putting the call > into that thread and let that thread not return while the main program > continues? Will it leave allocated memory, that is never freed? > You must call fork() first an then call execv from the child process. > If the function does not return, why is there a return integer value > defined? > (Or: why is it called a function, when it does not return?) Who knows? > > In the doc’s example the FPEXECV(path, pp) has the same pchar in the > path and as the first pchar of the pchar array that pp points to. I have > tried similar examples, and they always seem to work with the same phar > in the two places, but not otherwise. Is there some deeper philosophy in > having the program-name in both path and in the first phar of the array? > > Hans Maartensson > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal