run "exec fglrun program"
Posted in 2000
Topics: General Discussion
Hi I have a problem : when I compile to c-code and do run "exec other_program" from my code , I get expected behaviour - the process is replaced by the new one, but when i compile to p-code, and do run "exec fglrun other_program" it is started as new process and returns to previous one after quitting. I need help to solve this problem. thanks
That is just one of a handful of behavioral differences between the P-code and executable versions of 4GL. Since you are changing the RUN command for R4GL anyway just change to: RUN "fglrun otherprog" RETURNING exitcode EXIT PROGRAM (exitcode) When you are compiling for p-code. Art S. Kagel oscarek wrote: > > Hi > > I have a problem : > when I compile to c-code and do > run "exec other_program" > from my code , I get expected behaviour - the process is replaced > by the new one, but when i compile to p-code, and do > run "exec fglrun other_program" > it is started as new process and returns to previous one after quitting. > I need help to solve this problem. > > thanks
"Art S. Kagel" wrote: > That is just one of a handful of behavioral differences between the P-code > and executable versions of 4GL. Since you are changing the RUN command > for R4GL anyway just change to: > > RUN "fglrun otherprog" RETURNING exitcode > EXIT PROGRAM (exitcode) > > When you are compiling for p-code. Are you guys serious? First off, the use of fglrun suggests that we are dealing with Dynamic 4GL rather than Classic 4GL. Under Classic 4GL, both p-code and c-code, the 'exec' in the RUN statement cannot have any effect on the parent program -- the process forks and the child runs the 'exec other_program' code. This is important. The 'exec' does have a benefit; in fact, Classic 4GL forks and execs a shell, and the shell then execs other_program, so there is one less process created when 'exec' is used in the RUN command. If there is an assertion that Dynamic 4GL does not behave in substantially the same way as Classic 4GL, then there is a bug in at least one of the two D4GL variants. I don't see how 'run "exec other_program"' could replace the initial D4GL with the new one, unless it is an extension provided by 4J's. If so, it is at best dubious, IMNSHO, and most likely a bug. I don't recall seeing it documented (but I haven't looked all that hard at the documentation recently). And if there really is a difference between the p-code and c-code versions, then that is a bug in its own right. However, I should also point out that 4J's is not planning to continue the D4GL c-code system, so you should be using the p-code system. There are alternatives to the RUN statement provided by D4GL, too: fgl_system, WinExec, and WinExecWait. You may, however, need to provide a custom function such as i4gl_exec() which more or less does a simple exec() operation on the program specified as an argument. Just my $0.02. > oscarek wrote: > > I have a problem : > > when I compile to c-code and do > > run "exec other_program" > > from my code , I get expected behaviour - the process is replaced > > by the new one, but when i compile to p-code, and do > > run "exec fglrun other_program" > > it is started as new process and returns to previous one after quitting. > > I need help to solve this problem. -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"