Re: Expat and C++ ?

Jez Higgins <[email protected]>
Newsgroups gmane.text.xml.expat.general
Organization Jez UK Ltd
Message-ID <[email protected]>
hymedia wrote:
> The real problem is the C function calls... honestly... have waist enough
> time wraping Expat from c to c++ and it turns out to be realy ugly... I ll
> write my own c++ parser... thx anyways
> 

The callback functions need to be static and declared as extern "C", in
order to have the correct linkage.  Getting those to forward on to
member functions is pretty straightforward - pass the this pointer to
the Expat parser as userData, and you can then use it to forward the
call.  It took me about a morning's work from a standing start.  It's
not super-pretty, but there's no way to make it any prettier and I'll
take pragmatic over pretty any day.

My Arabica package - http://www.jezuk.co.uk/arabica - provides SAX, DOM
and XPath layered onto Expat, libxml2, Xerces or MSXML.  If it doesn't
do what you want, the Expat wrapper should give you a pretty clear steer
on what you need - look at saxexpat.h and saxexpat.cpp.

Jez

_______________________________________________
Expat-discuss mailing list
[email protected]
http://mail.libexpat.org/mailman/listinfo/expat-discuss
signature.asc (application/pgp-signature, 250 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEq4kcd5Jqiw9+jCsRAqhvAJ0SWRLcpQK1c1Cd991Pd+eH+h3cVwCePtRK
1H/JGg+W5fh2yNZfRtteTEg=
=JP1N
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.