Static Xerces Library
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Static Xerces Library

  1. #1
    Join Date
    Jun 2002
    Location
    Colorado, U.S.A.
    Posts
    980

    Static Xerces Library

    I'm using Xerces (from Apache.org) to parse XML files. I downloaded their project, which compiles the source into a dll file (and an import library). I want to statically link the xerces library. Does anyone know how to change the project (I can use the VS6 or VS7 project) to compile a library that I can statically link to? Thanks for any suggestions.

    Kelly

  2. #2
    Join Date
    Jun 2002
    Location
    Colorado, U.S.A.
    Posts
    980
    I created a new static library project and added all the xerces source files to it. When I try to compile it, I get 459 errors. However, they all seem to be one of two kinds. They are:

    error C2061: syntax error : identifier 'template'
    error C2059: syntax error : ';'
    error C2059: syntax error : '<'
    error C2143: syntax error : missing '{' before '<'

    or:

    error C2061: syntax error : identifier 'xercesc_2_3'
    error C2059: syntax error : ';'
    error C2449: found '{' at file scope (missing function header?)
    error C2059: syntax error : '}'

    Does anyone know anything about these errors?

    Also, the dll project that was provided links to several libraries (kernel32.lib user32.lib advapi32.lib ws2_32.lib). Is there anyway to link these with the static library? Do I need to? Thanks for any help.

    Kelly

  3. #3
    Join Date
    Jun 2002
    Location
    Colorado, U.S.A.
    Posts
    980
    I managed to get the library compiled. However, I don't know much about DLL's, so I'm having problems using the library since the code is still written to be used in a DLL.

    Each class in Xerces is written like this:

    class XMLUTIL_EXPORT XMemory
    {
    ...
    }

    Where XMLUTIL_EXPORT can be one of several different defines. However, each of the defines is eventually defined as PLATFORM_EXPORT or PLATFOR_IMPORT. Then these are defined like this:

    #define PLATFORM_EXPORT __declspec(dllexport)
    #define PLATFORM_IMPORT __declspec(dllimport)

    From what I've been able to find out, these defines are used to say what should be exported or imported in the DLL (or something close to that).

    When I statically link the library that is created with the defines intact, I get several linker errors like this:

    Dissector error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall xercesc_2_3::MemBufInputSource::MemBufInputSource(unsigned char const * const,unsigned int,char const * const,bool,class xercesc_2_3::MemoryManager * const)" (__imp_??0MemBufInputSource@xercesc_2_3@@QAE@QBEIQBD_NQAVMemoryManager@1@@Z)

    So I tried to change the PLATFORM defines to this (basically defining them as nothing):

    #define PLATFORM_EXPORT
    #define PLATFORM_IMPORT

    When I statically link the library now, the majority of the linker errors are gone. However, I still get these:

    Dissector error LNK2001: unresolved external symbol "private: __thiscall xercesc_2_3::XMemory::XMemory(class xercesc_2_3::XMemory const &)" (??0XMemory@xercesc_2_3@@AAE@ABV01@@Z)

    Dissector error LNK2001: unresolved external symbol _errno

    Dissector error LNK2001: unresolved external symbol "private: __thiscall xercesc_2_3::XMemory::XMemory(class xercesc_2_3::XMemory const &)" (??0XMemory@xercesc_2_3@@AAE@ABV01@@Z)

    Dissector error LNK2001: unresolved external symbol _errno

    Dissector error LNK2019: unresolved external symbol "private: __thiscall xercesc_2_3::XMemory::XMemory(class xercesc_2_3::XMemory const &)" (??0XMemory@xercesc_2_3@@AAE@ABV01@@Z) referenced in function "public: virtual class chsUtilities::cCHSString const __thiscall chsUtilities::cCHSTArray<class chsML::cCHSXMLNode *>::getClass(void)const " (?getClass@?$cCHSTArray@PAVcCHSXMLNode@chsML@@@chsUtilities@@UBE?BVcCHSString@2@XZ)

    Dissector error LNK2019: unresolved external symbol ___mb_cur_max referenced in function "public: __thiscall xercesc_2_3::CPMapEntry::CPMapEntry(char const * const,unsigned int,unsigned int)" (??0CPMapEntry@xercesc_2_3@@QAE@QBDII@Z)

    Dissector error LNK2019: unresolved external symbol _errno referenced in function "public: static bool __cdecl xercesc_2_3::XMLString::textToBin(unsigned short const * const,unsigned int &)" (?textToBin@XMLString@xercesc_2_3@@SA_NQBGAAI@Z)

    I don't know what else to try. Does anyone have any ideas on this? Thanks.

    Kelly

  4. #4
    Join Date
    Dec 2010
    Posts
    4

    Re: Static Xerces Library

    Does anyone know the solution to the linker errors here. I am facing the same problem. Thanks for any help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center