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 [EMAIL PROTECTED] referenced in function "public: void 
__thiscall xercesc_2_7::SocketJanitor::reset(unsigned int *)" ([EMAIL 
PROTECTED]@xercesc_2_7@@[EMAIL PROTECTED])
.\..\..\..\..\..\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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to