PRB: Errors in Chapter 16 of Advanced Programming Techniques

ID Number: Q66303

6.00 6.00a 6.00ax

OS/2

docerr

Because of printing problems and proofing oversight, there are several

documentation errors, shown in detail below, in Chapter 16 of the

"Microsoft C Advanced Programming Techniques" manual that shipped with

C versions 6.0 and 6.0a. These errors can cause various problems if

you are attempting to learn how to use C 6.0 to develop OS/2

applications.

SYMPTOMS

- Sample code fails to compile.

- Sample application fails to function correctly.

- Running a sample application causes SYS2070 error (Unable to

Demand Load application segment xxxxx) from the operating

system.

RESOLUTION

Please note the changes listed below and make these changes to your

copy of "Microsoft C Advanced Programming Techniques" manual.

More Information:

The following are documentation errors occurring in Chapter 16 of the

"Microsoft C Advanced Programming Techniques" manual, and their

corrections:

Page 404, example at top of page:

#pragma stack_check(off)

Should be as follows:

#pragma check_stack(off)

Program will not compile as is.

Page 404; example at top of page:

"while (s = TargetBuff)" and "while (d = TargetBuff)"

Both should be changed to the following:

"while (s >= TargetBuff)" and "while (d >= TargetBuff)"

The sample program will not function correctly as is.

Page 402, middle of page (details of /ML and /MD switch);

page 404, bottom of page;

page 410, bottom of page;

page 412, top of page (in the paragraph at the top);

page 412, bottom of page (in the example):

All define switches to the compiler should have underscores instead

of spaces (that is, /D MT should be /D_MT, and /D DLL should be

/D_DLL.

Without this, the correct sections of the include files will not

be used. Symptoms include incorrect program operation and link

failure (especially obvious with floating-point math functions).

Page 407, top of page;

page 411, bottom of page (end of step 3);

page 412, bottom of page:

All the link lines should include /NOI.

Without this, the programs that use the run time in a dynamic-link

library (DLL) will likely fail at run time due to name mismatch. In

the SYS2070 error message from the OS, the function name will

probably be uppercase with a leading underscore. The actual

function name is probably mixed case.

Page 411, top of page (end of step 2):

This step defines the building of the .DEF file for the

application-specific DLL. The .DEF file should also include "DATA

MULTIPLE." This fact was mentioned on page 398.

If this is not done, the program will likely run correctly until a

second process attempts to gain access to the DLL. At that time,

the second process will likely overwrite the run-time instance data

from the first process.

Page 412, bottom of page:

The sample LINK command line alludes to the fact that you must link

with CRTEXE.OBJ; however, it is not clear why. When building an

application that links with the C run-time DLL, the run-time DLL is

only loaded in memory and initialized by the .EXE. The calls to

make this happen are in CRTEXE.OBJ; therefore, you MUST use this if

you want to use the run-time DLL in your application. As a

corollary, if your DLLs link with the run-time DLL, your .EXE must

also. The DLLs are linked with CRTDLL.OBJ, while the .EXE link is

linked with CRTEXE.OBJ.

Additional reference words: 6.00 6.00a 6.00ax