IR
irwinrodriguez.dev
Back to docs

FoxCore

FoxCore.Runtime takes long work off the main Visual FoxPro thread. Each task starts its own VFP process, the script is injected into it, the result is collected and it is closed: VFP is still single-threaded, what you have is several VFPs. The application does not go dead in the meantime, and N tasks run at once.

Worth saying early, because it saves disappointment: FoxCore does not make code faster. Something that takes 40 seconds still takes 40 seconds. What changes is that it does not block, that you can show progress and cancel, and that several fit at the same time. And starting a worker costs between a tenth of a second and three seconds, so a 200 ms task is not a candidate: the start-up costs more than the work.

In this section

  • Installation: Requirements, the installer and registration in both registry views.
  • Quick Start: Your first task in another process, in under five minutes.
  • Advanced Patterns: The batch, the large batch, progress with cancellation, handlers and the blackboard.
  • API Reference: The six COM types, member by member, and what does not exist.
  • Examples: Three complete programs, exactly as they run.
  • Licensing: One license per company, what changed in 3.4.0 and how it is activated.

What it does

  • Runs the same VFP code, without rewriting it, in another process: with the result coming back, progress, cancellation, a deadline and a deterministic shutdown
  • MaxWorkers from 1 to 64 simultaneous processes; by default, min(cores, 8)
  • Progress and messages from inside the task with runtime.Progress(), read back with GetProgress() and GetProgressMessage() with no pumping needed
  • Cooperative cancellation: the task asks runtime.IsCancelled() on each turn of its loop
  • A deadline per task; when it runs out the task ends TimedOut and the worker dies
  • Total isolation: the worker does not see your variables, your work areas, your SETs or your cursors. It is born clean, and opens whatever it needs itself
  • The worker can call back into the host with Call(), and both sides share a blackboard through GetValue() and SetValue()
  • Frozen COM contract: six types, and members only ever grow at the end
What is not there, and is not worth looking for There is no Wait or WaitAll (the pattern is the loop with Pump()), no OnComplete / OnFailed events, no Task object and no FoxCoreClass: that was the classic engine, a different product line. The twenty-six example*.prg files floating around belong to it and do not apply here.

Requirements

ComponentRequirement
Visual FoxProVFP 9.0 SP2, registered as VisualFoxpro.Application.9. Which process acts as the worker can be changed with WorkerProgId
WindowsWindows 10 or 11
.NET Framework4.8
COM registrationWith the 32-bit RegAsm (mandatory: it is the one vfp9.exe looks at) and, since 3.4.0, the 64-bit one as well. The installer does it
One license per company, and no connection FoxCore is sold as one license per company at €299, with no seat counting. It is not a file: it is a JWT that you hand to Activate() in code, and it is validated locally, without calling any server. Since 3.4.0 it is required outside the IDE too, in the .exe or .dll you distribute. Without a valid license the life cycle still works (Attach, Ping, Shutdown), but tasks are born Failed. Published version: 3.4.2.