Microsoft KB Archive/65082

= &quot;Error During Run-Time Initialization&quot; Mixing Near/Far Strings =

Article ID: 65082

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q65082



SUMMARY
When you link separate modules together to make an .EXE program, all the modules must have been compiled with the same string option (near or far strings).

If you LINK modules or libraries together and some were compiled with and some without the BC /Fs (far strings) option, the .EXE program can hang in version 7.00, or can give the following error message at run time in version 7.10:

Error during run-time initialization

This information applies to Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.



MORE INFORMATION
Combining string options can cause unpredictable results in the .EXE program at run time. After the possible hang in 7.00, a warm boot (CTRL+ALT+DEL) may not work. To reboot, you may have to turn the computer off, then back on.

To avoid this problem, only LINK routines that were compiled with the same string option (BC /Fs or no /Fs).

Also, remember that the QBX.EXE environment of Basic PDS 7.00 and 7.10 only supports far strings, not near strings. In other words, all Basic object modules linked into a Quick library (.QLB file) for use in QBX.EXE must be compiled with the BC /Fs option.

What Are Far Strings?
The contents of far strings are stored in the far heap, and the contents of near strings are stored in near heap (the 64K DGROUP segment).

Note that the BC /Fs (far strings) option affects only the storage location of variable-length string variables. The far strings option does NOT affect fixed-length string variables. (Also, fixed-length strings do NOT have a string descriptor.)

Every variable-length string variable (or array element) has a 4-byte string descriptor. The 4-byte string descriptor for each variable-length string always resides in DGROUP (the 64K near heap) regardless of the compiler string option (near or far).



Code Example 1
Compile the following program with the BC /Fs option, as follows: BC TEST1/Fs;

REM TEST1.BAS CALL TEST Compile the following program with BC and no options, as follows: BC TEST2;

REM TEST2.BAS SUB TEST STATIC PRINT &quot;This is a test&quot; END SUB Link as follows: LINK TEST1+TEST2;

Now run TEST1.EXE. If compiled in Basic 7.00, the program may display random garbage on the screen and hang. If compiled in Basic 7.10, the program will give the error message &quot;Error during run-time initialization.&quot;

Code Example 2
Compiling and linking any program in Basic PDS 7.10 as follows gives &quot;Error during run-time initialization&quot; when you run the BASFILE.EXE program: BC /Fs basfile.BAS; LINK basfile.OBJ,,,BRT71ENR.LIB; Note that &quot;ENR&quot; in BRT71ENR.LIB refers to &quot;E&quot; for IEEE math, &quot;N&quot; for near strings, and &quot;R&quot; for MS-DOS (real) mode.

Additional query words: BasicCom

Keywords: KB65082

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.