Re: [xml] initGenericErrorDefaultFunc weirdness.



Jose Commins said:

      Odd, I am trying to use:

      initGenericErrorDefaultFunc((xmlGenericErrorFunc)MyXMLErrorFunction);

      But I get this error on compilation:

      main.c:109: passing arg 1 of `initGenericErrorDefaultFunc' from
incompatible pointer type

      And here's my function:

void MyXMLErrorFunction(void *ctx, const char *msg, ...)
{
      printf("Aiee!  And error has occured!\n");
}


      I've tried everything: using the direct address, different
assignments
and so on, but I either get the same error or bus errors.  I *do*
have
this working:

      xmlSetGenericErrorFunc(NULL,
(xmlGenericErrorFunc)MyXMLErrorFunction);

      And that works fine.

      But, am I doing something wrong with the declaration/assignment of
'initGenericErrorDefaultFunc' or is it b0rked?


Regards,
              Jose.

From xmlerror.h:
XMLPUBFUN void XMLCALL
    xmlSetGenericErrorFunc      (void *ctx,
                                 xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL
    initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);

so perhaps you could try

initGenericErrorDefaultFunc(&(xmlGenericErrorFunc)MyXMLErrorFunction);

(i.e. use the '&' address-of operator)?

Regards,

Bill




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