The VBLM_RTString() function is the core of runtime switching. It takes one argument (a long string index) and returns a string from the language database or resource. When VBLM builds an RSV, it replaces translated strings with calls to VBLM_RTString().
VBLM provides three different versions of VBLM_RTString(), one designed for ANSI text format language databases, one for binary format, and one for use with resource files. The ANSI text version is defined in the VBLM_RTA*.BAS support modules, the binary version in VBLM_RTB*.BAS, and the resource version in VBLM_RTR*.BAS. VBLM copies and includes the appropriate version when it performs the build (unless you tell it not to -- see runtime switching support files).
The resource version is sufficiently different from the database version that it is explained separately under Using Resource Files. The following applies only to the database versions.
The first time VBLM_RTString() is called, it initializes the database (it also does this if passed -1 as the index: see Enabling On The Fly Switching.). The source code for all versions is fully documented and included in this help file. You'll get the best understanding of this process by reading it, but here's what happens in brief:
1) VBLM opens the database file and retrieves the number of language tables it contains and their names and offsets within the file.
2) If the command line does not contain "/L=ValidLanguageName," and there is more than one language in the database, the function modally displays frmVBLM_RTS and waits for the user to select a language.
3) By default, VBLM_RTString() then loads the strings in the selected language table into a static array of type tagVBLM_VS and closes the file. This optimizes performance for speed. If you have built a binary format database, you can easily reconfigure the function to optimize for memory use by changing the OPTIMIZATION constant in the source code (this option is not available for ANSI text databases). If you do, VBLM_RTString() builds an array of file pointers and leaves the file open. The Optimization method is fully explained in the code.
The Optimization method selected has an obvious effect on the source of the string that VBLM_RTString(x) returns. When optimized for speed, the string is in memory as element x of the static string array, and the function returns it without further ado. When optimized for memory, the string is in the disk file at the location pointed to by element x of the static pointer array, and the function has to seek and fetch. If the host system has a disk cache, however, the majority of calls will not actually result in a trip out to disk; the data will be in the cache.
Note for Power Users: As of V4.02, VBLM gives you the option of inserting your own version of VBLM_RTString(), and naming it whatever you want. If you do, however, make sure that your version provides the necessary functionality.
See Also: