[xml] questions about using xmlGlobalState



I'm trying to figure out the libxml/globals.h headers. My version of
libxml2 on Red Hat Enterprise Linux AS release 3 (Taroon Update 6) has
LIBXML_USE_THREAD set. If I try to use the xmlGlobalState struct and
access, for example, the xmlParserVersion field, the preprocessor
substitutes in (*(__xmlParserVersion())) and the code will not work.

So I guess the questions are:
1) should LIBXML_USE_THREAD be used in userland code?
2) do I need to include something besides globals.h?

My test code is:

#include <stdio.h>
#include <libxml/globals.h>

int main () {
#ifdef LIBXML_THREAD_ALLOC_ENABLED
        printf("thread alloc\n");
#endif
#ifdef LIBXML_THREAD_ENABLED
        printf("thread enabled\n");
#endif
        xmlGlobalState state;
        printf(state.xmlParserVersion);
        return 0;
}

After the preprocessor, this becomes:

int main () {




        printf("thread enabled\n");

                xmlGlobalState state;
                printf(state.(*(__xmlParserVersion())));

                return 0;
}

Thanks.

--
Hisashi T Fujinaka - htodd twofifty com
BSEE(6/86) + BSChem(3/95) + BAEnglish(8/95) + MSCS(8/03) + $2.50 = latte



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]