PRB:C Run Time Can't Be Used in DLL Initializing w/ CRTLIB.DLL

ID Number: Q50700

5.10 6.00 6.00a 6.00ax | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

SYMPTOMS

In Microsoft C versions 5.1, 6.0, 6.0a, and 6.0ax, in general, you

cannot call the run-time library from a multithreaded .DLL

initialization routine (one that uses CRTLIB or CEXAMPLE).

The reason is that C_INIT() doesn't completely initialize

CRTLIB.DLL or CEXAMPLE.DLL; this is not initialized until the .EXE

start-up code is executed.

You still must call C_INIT() from within your .DLL initialization

routine in order to perform other necessary initializations.

RESOLUTION

There are two possible workarounds:

- Write your own functions to replace sprintf().

- Don't use user initialization; instead, call an initialization

routine in your .DLL from the beginning of your .EXE. Because

the code in your .EXE does not execute until after the .EXE's

start-up is executed, CRTLIB.DLL will be initialized by the

time you attempt to initialize your .DLL.

Additional reference words: 5.10 6.00 6.00a 6.00ax