FIX: Port I/O Functions Not in DLL Version of CRT for VC++ 4.0Last reviewed: September 19, 1997Article ID: Q152030 |
4.00
WINDOWS NT
kbprg kbbuglist kbfixlist
The information in this article applies to:
SYMPTOMSWhen compiling a program that uses the _inp and _outp instructions and links with the DLL version of the CRT, you will see one or more of the following errors:
test.obj : error LNK2001: unresolved external symbol __inp test.obj : error LNK2001: unresolved external symbol __inpw test.obj : error LNK2001: unresolved external symbol __inpd test.obj : error LNK2001: unresolved external symbol __outp test.obj : error LNK2001: unresolved external symbol __outpw test.obj : error LNK2001: unresolved external symbol __outpd test.exe : fatal error LNK1120: 6 unresolved externals CAUSEThe _inp and _outp functions are not exported from the DLL versions of the C Run-time Library (CRT), and do not exist in those versions of the CRT. If you try to use these functions with the DLL version of the CRT, you will get LNK2001 errors.
RESOLUTIONThere are several ways to get around the LNK2001 errors:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Visual C++, 32-bit Edition, version 4.1.
MORE INFORMATIONYou can avoid the linker errors by using a #pragma intrinsic instruction that will replace the _inp and _outp function calls with their assembly equivalents. In each file that refers to the _inp or _outp instruction, add the following line:
#pragma intrinsic(_inp,_inpw,_inpd,_outp,_outpw,_outpd)A similar method that can be used to avoid the link errors is to turn on intrinsic function optimizations for all intrinsic functions. If you are using the Command Line compiler, adding the /Oi switch to the compile options will enable intrinsic function optimizations. To turn on this optimization within Developer Studio, perform the following steps:
ARTICLE-ID: Q140584 TITLE : How to Link with the Correct C Run-Time (CRT) Library |
Additional reference words: 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |