Thread: using libxml2

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    26
    Rep Power
    0

    using libxml2


    Is anyone familiar with the libxml2 library?
    I want to use it in a c++ program but I believe there are some problems with that. I think the libxml2 library uses words that are reserved in c++, it even uses new as a variable.
    Any advice at all is greatly appreciated.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Flint, MI
    Posts
    328
    Rep Power
    13
    Gamgee,

    So long as your library is compiled with a C compiler (which it will have to be), you won't have any problems. libxml2 is perfectly content with C, even though the xml movement seems hell bent on using python for everything.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development
    http://www.lazarusid.com/notes/
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    26
    Rep Power
    0

    but...


    doesnt libxml2 use "new" as a variable?
    though this is reserved in c++.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Flint, MI
    Posts
    328
    Rep Power
    13
    If it does, it is used internally, so won't affect your C++ program. In the event that it's declared in one of the header files, wrap it in:

    Code:
    extern "C" {
      #include <xml.h>
    }
    That should keep your C code from irritating your C++ compiler. I think that this wrapping is already done internally by the header file though.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development
    http://www.lazarusid.com/notes/
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    26
    Rep Power
    0
    cool, cheers for the help Clay.

IMN logo majestic logo threadwatch logo seochat tools logo