Re: [xml] Re: How to detect at run-time whether libxml2 was compiled with enabled mutlithreading support?



Daniel Veillard wrote:

  i.e. basic, minimal. Your suggestion has vertues, it does make sense
and it's not too late to provide something like that instead.

Well, I have no need for such functionality, so I am not going to
provide a full implementation, but only the blueprint. It should be
quite easy for anybody to complete this function.

This goes in some general header file:

/**
 * xmlFeature:
 *
 * Used to examine the existance of features that can be enabled
 * or disabled at compile-time.
 */
typedef enum {
    XML_FEATURE_THREAD = 1
} xmlFeature;


This goes in some general source file:

/**
 * xmlHasFeature:
 * @feature: the feature to be examined
 *
 * Examines if the library has been compiled with a given feature.
 *
 * Returns a non-zero value if the feature exist, otherwise zero.
 * Returns zero (0) if the feature does not exist or an unknown
 * unknown feature is requested, non-zero otherwise.
 */
int
xmlHasFeature(xmlFeature feature)
{
    switch (feature) {
    case XML_FEATURE_THREAD:
#if LIBXML_THREAD_ENABLED
        return 1;
#else
        return 0;
#endif
    default:
        return 0;
    }
}



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