Compiling Source Code
In Visual FoxPro, you can compile Visual FoxPro source code into run-time files created with VFP9R.dll or VFP9T.dll. For more information about run-time files, see Visual FoxPro Run-Time Libraries.
Earlier versions of Visual FoxPro required using macro substitution or expression evaluation for each line to execute code generated at run time. This process was not always optimal because of the complexities of executing large blocks of code and the performance penalty incurred using the macro operator &, or the EVALUATE( ) function.
The COMPILE command is available in the runtime so that your applications can generate and compile a program (.prg) file. Run-time compilation works with all files supported by the COMPILE command including programs, forms, classes, labels, reports and databases. You can use the STRTOFILE( ) function to output your code to a .prg file.
There are a few differences between the compiler in the development product and in the runtime:
The "?" switch in the COMPILE command is unavailable for the runtime because unattended automation servers (.dlls) do not allow modes involving user input.
The SET DEVELOPMENT command has no effect in the runtime.
With the full product, SET DEVELOPMENT causes Visual FoxPro to compare the creation date and time of a program with those of its compiled object file when the program is run. If SET DEVELOPMENT is set to ON, the latest version is always executed – out-of-date programs are automatically recompiled. In the runtime, you must explicitly call the COMPILE command to recompile source. This means that calling the DO command in your runtime will never cause the .prg file to be recompiled. Also, with the runtime, the DO command ignores the file extension and looks for a file with an .fxp extension, even if you specify a .prg file.