Functions, Procedures, Libraries

Coordinator
Feb 6, 2012 at 7:03 AM
Edited Feb 6, 2012 at 7:05 AM

I will add the following update to the Docs:

Custom VFP Functions, Procedures, Methods that are solid and won't change often can use the traditional ways to centralize VFP code:

SET PROC TO  ... ADDITIVE,

CREATEOBJECT,

etc  (see examples).  These objects will be cached by IIS and perform very fast.  The problem is IIS won't let you change these objects unless you re-cycle the App or IIS.

The Solution:  Functions and Procedures that are in development or may change often can simply be placed at the bottom of Main.prg to be available to all scripts. (IOW, main.prg is your new Function/Procedure Library)

Alternatively, if your Functions/Procedures are in their own files, containing only the one Function/Procedure, use ExecScript to run them on the fly from your scripts without caching in IIS and therefore not locking them:

lcRetVal = EXECSCRIPT(FILETOSTR(oProp.AppStartPath+'\prg\myexternalfunc.prg'))

You may change the Functions and Procedures used in these methods as needed.