BUG: Cannot locate the procedure entry point FreeAddrInfoW when you run an application on Windows Server 2003 or on Windows XP (822334)
The information in this article applies to:
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++ .NET (2002), when used with:
- Microsoft Windows Server 2003, Datacenter Edition
- Microsoft Windows Server 2003, Enterprise Edition
- Microsoft Windows Server 2003, Standard Edition
- Microsoft Windows Server 2003, Web Edition
- Microsoft Windows XP Professional
- Microsoft Windows XP Home Edition
Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003 support both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code. SYMPTOMSWhen you run a Unicode-enabled application that uses the FreeAddrInfo Windows Sockets function, or that uses helper classes such as ATL::CSocketAddr on a computer that is running Microsoft Windows Server 2003 or Microsoft Windows XP, you may receive the following error message: The procedure entry point FreeAddrInfoW could not be located in
the dynamic link library WS2_32.dll. CAUSEThe ws2_32.dll library does not export the FreeAddrInfoW symbol that you must have to use the Unicode version of the FreeAddrInfo function.RESOLUTIONTo resolve this problem, follow these steps: - Copy the Atlsocket.h file to any directory that you want to use. This file is located in the following directory:
Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include - Add the following block of code to the copy of the Atlsocket.h file that you created in step 1.
//Atlsocket.h
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "mswsock.lib")
//Start of Addition
#if _WIN32_WINNT < 0x0502
#define ADDRINFOT addrinfo
#define GetAddrInfo getaddrinfo
#define FreeAddrInfo freeaddrinfo
#endif
//End of Addition namespace ATL - Start Microsoft Visual C++.
- On the Tools menu, click Options. In the left pane of the Options dialog box, expand Projects, and then click VC++ Directories.
Note If you are using Visual C++ Express Edition, expand Projects and Solutions in the left pane of the Options dialog box, and then click VC++ Directories. - Under Show directories for, click Include files. Then, add the directory where the modified version of the Atlsocket.h file is located to the top of the list.
- Rebuild you application
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.REFERENCESFor more information about changes that have been made to ATL, visit
the following Microsoft Developer Network (MSDN) Web site: For
more information about new Windows Socket functions that have been added to the Windows Socket API, visit the following MSDN Web site:
Modification Type: | Minor | Last Reviewed: | 1/5/2006 |
---|
Keywords: | kbWinsock kbAPI kbAppDev kbbug KB822334 kbAudDeveloper |
---|
|