ID Number: Q72481
6.00 6.00a
OS/2
buglist6.00 buglist6.00a fixlist7.00
Summary:
The Microsoft C Compiler versions 6.0 and 6.0a generate an external
reference to the symbol __aDBused when code is compiled with the /qc
and /Zi options (for quick compiling and to generate CodeView symbolic
debug information). This symbol is usually resolved in the C run-time
library. If you are creating a DLL that does not use C run-time code
and you don't include the run-time library on the link line, the
linker may return the following error message:
L2029: '__aDBused' : unresolved external
To work around this error, you should define an int called _aDBused
(with a single underscore) in your code. The sample code below
illustrates the problem and this solution:
More Information:
If you do include the run-time library LLIBCDLL.LIB on your LINK
command line, then _aDBused will be resolved but 4K of dead code will
be linked into the DLL in the process. If you specify one of the
standard C run-time libraries (LLIBCEP.LIB, for instance) rather than
the DLL library, the following link error will result:
L2029: '_main' : unresolved external
Microsoft has confirmed this to be a problem in C versions 6.0 and
6.0a. This problem was corrected in C/C++ version 7.0.
Sample Code
-----------
/* TEST.C */
/* Compile options needed: /qc /Zi /Gs /c
LINK line: LINK /CO /NOI TEST,TEST.DLL,,/NOD OS2.LIB, TEST.DEF;
*/
#include <os2.h>
// int _aDBused; // Uncomment for workaround
void DllFunc(void)
{
return;
}
========================================================
; TEST.DEF
LIBRARY TEST