You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Michael Mason <mg...@decisionsoft.com> on 2000/02/16 13:32:31 UTC

Re: [Xerces-C] Building a static library with xerces-c

Christophe GOETZ wrote:

> Had anyone had any experience of building a static library instead of a shared
> one?

The error you're getting is because the platform specific code looks for
the LD_LIBRARY_PATH environment variable and doesn't work for a static
version. You can get around this by hacking the
src/util/Platforms/Linux/LinuxPlatformUtils.cpp file. Specifically, fix
XMLPlatformUtils::platformInit() so that it returns after setting up its
mutex:

void XMLPlatformUtils::platformInit()
{
    //
    // The atomicOps mutex needs to be created early.
    // Normally, mutexes are created on first use, but there is a
    // circular dependency between compareAndExchange() and
    // mutex creation that must be broken.

    atomicOpsMutex.fHandle = XMLPlatformUtils::makeMutex();
    XMLPlatformUtils::fgLibLocation = NULL;
    return;

    // Leave the rest of the code here if you want
}

You can then build yourself a static library and it'll work. This is a
pretty yukky hack, but there was a thread on this a while back and we
didn't really reach a conclusion. I'm happy doing this for now, and
(when I get some time... ;) will check out the latest code and try to
fix something more satisfactory.

Hope this helps,

Mike.

-- 
Mike Mason, Software Engineer
XML Script Development Team                    Office: 44-1865-203192
http://www.xmlscript.org/                      Mobile: 44-7050-288923