DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16085>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16085

XMLPlatformUtils::Initialize() fails to execute any code when called from an shared 
object

           Summary: XMLPlatformUtils::Initialize() fails to execute any code
                    when called from an shared object
           Product: Xerces-C++
           Version: 2.1.0
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Utilities
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have compiled Xerces2.1 (stable) on Solaris 2.8 using g++ 2.95.3.  The 
samples execute properly.  I am linking the xerces.so to another shared object 
I am creating.  This shared object is loaded by an application at run time, 
when I call XMLPlatformUtils::Initialize() from the shared object the code 
executes the call, but never actually performs any code within that function - 
I know this because I have editted the Initialize() function and outputed a 
debug statement to a file (this works successfully during execution of one of 
the samples).  After Initialize returns, the code continues and then once the 
code tries to execute getDOMImplementation(), the shared object core dumps, 
because the global mutex lock is null, since the new XMLMutex statement is 
never executed within Initialize().  I placed debug statements in this Xerces 
code as well, and know that the function executes, and crashes once the code 
tries to lock to set the cleanupfunction.

Is there any reason that Initialize wouldn't execute the code??  I have 
attached the shared object code as well as the Makefile.  I also tried with 
c++, and that failed the exact same way.



Here is the shared object code:

extern "C" unsigned int OBLIX_DLLEXPORT Crap(const char *eventName, ObPPPData 
*data)
{
    int iStatus = STATUS_PPP_OK;                    // Return code

    AbstractDOMParser::ValSchemes valScheme = AbstractDOMParser::Val_Auto;
    bool                       doNamespaces       = false;
    bool                       doSchema           = false;
    bool                       schemaFullChecking = false;
    bool                       errorOccurred = false;

    try
    {
        FILE *fp = fopen("/opt/netpoint/custom/xerces.txt", "w");
        fprintf(fp, "Before Initialize\n");
        fclose(fp);

        XMLPlatformUtils::Initialize();

        fp = fopen("/opt/netpoint/custom/xerces.txt", "a");
        fprintf(fp, "After Initialize\n");
        fclose(fp);

    }
    catch (const XMLException& toCatch)
    {
        data->SetResultString("NonInternalUser: XML Exception occured");
        return STATUS_PPP_ABORT;
    }
    catch (...)
   {
        data->SetResultString("S Happens");
        return STATUS_PPP_ABORT;
    }

    try
    {
        // Instantiate the DOM parser.
        static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };

        DOMImplementation *impl = 
DOMImplementationRegistry::getDOMImplementation(gLS);

        DOMBuilder        *parser = ((DOMImplementationLS*)impl)-
>createDOMBuilder(DOMImplementationLS:
:MODE_SYNCHRONOUS, 0);

        parser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces);
        parser->setFeature(XMLUni::fgXercesSchema, doSchema);
        parser->setFeature(XMLUni::fgXercesSchemaFullChecking, 
schemaFullChecking);

        if (valScheme == AbstractDOMParser::Val_Auto)
        {
            parser->setFeature(XMLUni::fgDOMValidateIfSchema, true);
        }
        else if (valScheme == AbstractDOMParser::Val_Never)
        {
            parser->setFeature(XMLUni::fgDOMValidation, false);
        }
        else if (valScheme == AbstractDOMParser::Val_Always)
        {
         parser->setFeature(XMLUni::fgDOMValidation, true);

etc.

Makefile
----------
CC       = g++

SHARED_LIB_EXT       = so

CFLAGS = -c -DSOLARIS -D_REENTRANT -fpic -Wall -g -O2 -I. -I/usr/local/include -
I/opt/netpoint/identity
/oblix/include/ppp -I/opt/netpoint/custom/xerces-c-src2_1_0/include -
I/opt/netpoint/custom/ldap/include

LOADFLAG = -DSOLARIS -fpic -mt -shared -L/usr/lib -L/usr/local/lib -
L/opt/netpoint/custom/ldap/lib -L/o
pt/netpoint/custom/xerces-c-src2_1_0/lib -lxerces-c -lldap50 -lpthread

all : fed.$(SHARED_LIB_EXT)

fed.$(SHARED_LIB_EXT) : common.o FedHandler.o InternalUser.o NonInternalUser.o 
IntUserToServices.o test
.o
    $(CC) $(LOADFLAG) -o $@ common.o FedHandler.o InternalUser.o 
NonInternalUser.o IntUserToServices.o
test.o

common.o : common.cpp
    $(CC) $(CFLAGS) common.cpp -o $@

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to