You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Rick Parrish (JIRA)" <xe...@xml.apache.org> on 2007/01/08 10:53:27 UTC

[jira] Commented: (XERCESC-1665) XercesLib fails to link on Microsoft Visual Studio 7.1

    [ https://issues.apache.org/jira/browse/XERCESC-1665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462986 ] 

Rick Parrish commented on XERCESC-1665:
---------------------------------------

Thanks Alberto!

> XercesLib fails to link on Microsoft Visual Studio 7.1
> ------------------------------------------------------
>
>                 Key: XERCESC-1665
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1665
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Build
>    Affects Versions: 2.7.0
>         Environment: Microsoft Visual Studio 7.1 "Enterprise Architect"
>            Reporter: Rick Parrish
>
> Download 2.7.0 tarball; unzip source tree; open the \xerces-c-src_2_7_0\Projects\Win32\VC7.1\xerces-all solution in VS7.1; select build-all to build entire solution. The XercesLib library is successfully built but all of the demo projects that link to it fail. Sample error message:
> ------ Build started: Project: StdInParse, Configuration: Static Debug Win32 ------
> Linking...
> xerces-c_static_2D.lib(BinHTTPURLInputStream.obj) : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "public: void __thiscall xercesc_2_7::SocketJanitor::reset(unsigned int *)" (?reset@SocketJanitor@xercesc_2_7@@QAEXPAI@Z)
> .\..\..\..\..\..\Build\Win32\VC7.1\StaticDebug/StdInParse.exe : fatal error LNK1120: 1 unresolved externals
> Examining the "SocketJanitor" class declared inside BinHTTPURLInputStream reveals that the reset function directly calls the WinSocket 2.0 API "clocksocket" function while the rest of the code calls a DLL thunk function. I presume the purpose of the thunking fuctions is to remove any direct linking dependency to the winsock library. However, directly calling "closesocket" in the helper class breaks that.
> Work around #1 - use a #pragma comment(lib, "ws2_32") to force linking the winsock DLL and supress the link error.
> Work around #2 - modify the janitor helper class as follows:
> Replace this ...
> 	void reset(SOCKET* p = 0) { if(fData) closesocket(*fData); fData=p; }
> ... with this ...
> 	void reset(SOCKET* p = 0) { if(fData && gWSclosesocket) gWSclosesocket(*fData); fData=p; }
> This also requires moving the gWSsocketclose declaration ahead of the SocketJanitor class inside BinHTTPURLInputStream.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org