Share via


VFP7R.DLL Run-Time Library

Vfp7r.dll provides services for the following types of Visual FoxPro-generated applications:

  • Distributed applications (.exe files)
  • ActiveDocuments (.app files)
  • Out-of-process servers (.exe files)
  • In-process servers (.dll files)

This is the primary run time used by Visual FoxPro for most types of applications.

The Visual FoxPro run time, vfp7r.dll, does not service multiple in-process .dll Automation servers. Each in-process .dll now uses a separate instance of the vfp7r.dll run time. The following rules determine how in-process .dlls use the vfp7r.dll run time:

  • The in-process .dll first called has exclusive use of the vfp7r.dll run-time library (typically installed in the System folder or the System32 folder, depending on your operating system).

    If an in-process .dll already has exclusive use of the vfp7r.dll run time, a renamed copy of the vfp7r.dll run time is created on disk and loaded into memory for each in-process .dll called. The vfp7r.dll run time is assigned a name based on the name of the in-process .dll. For example, if an in-process .dll named Myserver.dll is called, a copy of the vfp7r.dll run time is renamed to myserverr.dll (note the "r" appended to the name) and is loaded into memory to service the in-process .dll. This can also occur with a Visual FoxPro .exe server creating an instance of a .dll server – a situation where both would be sharing the same run time from the same process.

  • Visual FoxPro run times are renamed only for in-process .dlls that run within the same process. This means that two separate clients, each running in their own process, can load two different Visual FoxPro in-process .dlls without the run time being renamed. In this case, both Visual FoxPro in-process .dlls use vfp7r.dll because the clients load in separate processes.

  • Multiple Automation servers (created with OLEPUBLIC clause in the DEFINE CLASS command) in a single in-process .dll share the same vfp7r.dll run time. In this case, it's possible that the Automation servers can affect each other by sharing PUBLIC memory variables, setting the same SET commands, and so on if they reside on a common thread. Be careful that multiple Automation servers in a single in-process .dll don't interfere with each other. The new Session class can help eliminate some of these conflicts.

You can use the vfp7r.dll library with in-process .dll servers. Because there are limitations in using vfp7r.dll, you should consider using the vfp7t.dll run time instead. The vfp7r.dll run time does not fully protect instance data and globals, therefore the library blocks multiple objects from executing code concurrently. If one of the objects is executing code, all other instances must queue up to execute code. As soon as the object executing code finishes, another object can enter the run time to begin its execution (whether it is a property assignment or method invocation). While this may not be ideal in many application scenarios, there are certain types of server applications where this may be the optimal approach.

In a typical Microsoft Transaction Server (MTS) application, the Visual FoxPro .dll servers are deployed in packages represented by a single MTS process. MTS generates (or reuses) a thread for each client requesting an instance (OLEPUBLIC) from a Visual FoxPro server. Since MTS applications often require enterprise scalability, there is the potential for many concurrent instances to access your Visual FoxPro server simultaneously. If only one client (instance) is allowed to execute code at a time, all others must wait. With a single processor machine, this may be fine, depending on the nature and execution times of methods in your server. Remember, a single processor can only run one line of code at a time.

You should always consider using the vfp7t.dll run time for multiple processor machines since each processor can simultaneously execute code for different objects. Since vfp7r.dll blocking behavior prevents simultaneous code execution, you should use vfp7t.dll for most situations.

See Also

Visual FoxPro Run-Time Libraries | VFP7T.DLL Run-Time Library | Interoperability and the Internet | Server Design Considerations and Limitations | Scalability and Multithreading