I had a similar problem because I kept all the functions in one include file. The best solution is to break up the functions into separate ".p" files and then add them to the SUPER-PROCEDURES. Keep in mind that my example is based that every program I write uses a function from a common list of functions.
".p" Example....
mathfunctions.p - contains mathematical functions/procedures
guifuntions.p - contations funtions/procedures that manipulate widgets
validatefunctions.p - contations funtions/procedures used to validate form data
Once you break up the functions into seperate ".p" files, you need to create ".i" files to point that these functions are going to be run in the super procedures. The Procedures defined in the ".p" files do NOT need to be forwarded/pointed. Just functions only.
".i" Forwarder Example....
{mathfuntions.i} contains:
Code:
FUNCTION AreaOfRectangle RETURNS DECI (iHeight AS DECI, iWidth AS DECI) IN SUPER.
FUNCTION AddVars RETURNS DECI (iNum1 AS DECI, iNum2 AS DECI) IN SUPER.
Next, add the includes to the function/procedure programs so if a function that is called in mathfunctions.p from guifunctions.p will work.
Include in ".p" Example....
mathfunctions.i contains:
Code:
{guifunctions.i}.
{validatefunctions.i}.
guifunctions.i contains:
Code:
{mathfunctions.i}.
{validatefunctions.i}.
validatefunctions.i contains:
Code:
{guifunctions.i}.
{mathfunctions.i}.
Finally, one more include file that will run the procedures (if not allready in memory) and add them to the SUPER-PROCEDURES.
"mainfunctions.i" Example:
Code:
/** mainfunctions.i **/
DEF VAR hnMathFunctions AS HANDLE NO-UNDO.
DEF VAR hnGUIFunctions AS HANDLE NO-UNDO.
DEF VAR hnValFunctions AS HANDLE NO-UNDO.
DEF VAR xHasMath AS LOGI NO-UNDO.
DEF VAR xHasGUI AS LOGI NO-UNDO.
DEF VAR xHasVal AS LOGI NO-UNDO.
DEF VAR hnLoop AS HANDLE NO-UNDO.
hnLoop = SESSION:FIRST-PROCEDURE.
REPEAT:
IF hnLoop = ? THEN
LEAVE.
ASSIGN
xHasGUI = (IF hnLoop:FILE-NAME = "guifunctions.p" THEN YES ELSE xHasGUI)
xHasVal = (IF hnLoop:FILE-NAME = "validatefunctions.p" THEN YES ELSE xHasVal)
xHasMath = (IF hnLoop:FILE-NAME = "mathfunctions.p" THEN YES ELSE xHasMath)
hnLoop = hnLoop:NEXT-SIBLING.
END.
IF NOT xHasGUI THEN
DO:
RUN guifunctions.p PERSISTENT SET hnGUIFunctions. /** Run and store into HANDLE */
SESSION:ADD-SUPER-PROCEDURE(hnGUIFunctions). /** Add to SUPER */
END.
{guifunctions.i}. /** Include GUI Function pointers **/
IF NOT xHasMath THEN
DO:
RUN validatefunctions.p PERSISTENT SET hnValFunctions. /** Run and store into HANDLE */
SESSION:ADD-SUPER-PROCEDURE(hnValFunctions). /** Add program from HANDLE to SUPER */
END.
{validatefunctions.i}. /** Include Validation Function pointers **/
IF NOT xHasMath THEN
DO:
RUN mathfunctions.p PERSISTENT SET hnMathFunctions. /** Run and store into HANDLE */
SESSION:ADD-SUPER-PROCEDURE(hnMathFunctions). /** Add to SUPER */
END.
{mathfunctions.i}. /** Include Math Function pointers **/
Now all you have to do is have the {mainfunctions.i} to all programs that use these common functions. It will never need to Run the programs again and you will get by those pesky segment size limitations.
Hope This helps,
Bradley Worrell-Smith
http://www.stompfest.com