Compiling C read only code from 4GL
Posted in 1999
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Jobs, Consulting & Announcements
I am writine a 4GL "control" program that will be executing (via the RUN command) other 4ge's. Often these 4ge's will be the same program, but not always. However, the logic will ALWAYS be :- WHILE NOT FINISHED RUN Program1.4ge Wait for program to finish END WHILE As this "Control" Program will be potentially loading thousand's of these 4ge's, I need to ensure it does so in the fastest possible way. Am I right in assuming the following :- When you compile and link a 4GL program (NOT using shared libaries) that the 'C' compiler automatically (ie, not passing any extra flags to it via the 4GL screen front end) builds the executable code so that is split into read only code segment and data segment. When the "control" program RUNS a 4ge for the first time, both the read only code and then the datasegment are loaded into memory. When the "control" program loads subsequent versions of the same 4ge, only the data segment is loaded, thus speeding up program loading. I presume, if the above is the case, these read only code processes will only be terminated when the "control" program finishes, as it is the parent and they are its children. Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.
munsoor.negyal@datelgroup.com wrote: > > I am writine a 4GL "control" program that will be executing (via the > RUN command) other 4ge's. Often these 4ge's will be the same program, > but not always. > > However, the logic will ALWAYS be :- > > WHILE NOT FINISHED > RUN Program1.4ge > Wait for program to finish > END WHILE RUN waits for the program to finish anyway. Only RUN ... WITHOUT WAITING doesn't. > As this "Control" Program will be potentially loading thousand's of > these 4ge's, I need to ensure it does so in the fastest possible way. > Am I right in assuming the following :- > > When you compile and link a 4GL program (NOT using shared libaries) > that the 'C' compiler automatically (ie, not passing any extra flags > to it via the 4GL screen front end) builds the executable code so that > is split into read only code segment and data segment. When the > "control" program RUNS a 4ge for the first time, both the read only code > and then the datasegment are loaded into memory. When the "control" > program loads subsequent versions of the same 4ge, only the data > segment is loaded, thus speeding up program loading. Yes. These days, you practically cannot do other than create separable text and data segments. > I presume, if the above is the case, these read only code processes > will only be terminated when the "control" program finishes, as it is > the parent and they are its children. I don't understand your question. The o/s will ensure that the code segment is not unloaded until all programs using the code segment have terminated. Note that using shared libraries would reduce the amount of code to be loaded for every instance of every I4GL program, at a very modest cost in startup time (modest enough to be outweighed by the benefit of having the reduced amount of code to load). -- Yours, Jonathan Leffler (jleffler@informix.com) #include <witticism.h> Guardian of DBD::Informix v0.60 (v0.61_02) -- http://www.perl.com/CPAN Informix IDN for D4GL & Linux -- http://www.informix.com/idn