[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 6. Using the library

XML/Ada is a library. When compiling an application that uses it, you thus need to specify where the specifications are to be found, as well as where the libraries are installed.

There are several ways to do it:

- The simplest is to use the `xmlada-config` script, and let it provide the list of switches for `gnatmake`. This is more convenient on Unix systems, where you can simply compile your application with

      gnatmake main.adb `xmlada-config`

  Note the use of backticks. This means that `xmlada-config` is first executed, and then the command line is replaced with the output of the script, thus finally executing something like:

      gnatmake main.adb -Iprefix/include/xmlada -largs -Lprefix/lib \
        -lxmlada_input_sources -lxmlada_sax -lxmlada_unicode -lxmlada_dom

  Unfortunately, this behavior is not available on Windows (unless of course you use a Unix shell). The simplest in that case is to create a ``Makefile'`, to be used with the `make` command, and copy-paste the output of `xmlada-config` into it.

  `xmlada-config` has several switches that might be useful:

  1. ``--sax'`: If you this flag, your application will not be linked against the DOM module. This might save some space, particularly if linking statically. This also reduces the dependencies on external tools.

  2. ``--static'`: Return the list of flags to use to link your application statically against Xml/Ada. Your application is then standalone, and you don't need to distribute XMl/Ada at the same time.

  3. ``--static_sax'`: Combines both of the above flags.

- On Windows system, you might also simply want to register once and for all the library in the Windows registry, with the command `gnatreg`. This means that `GNAT` will automatically find the installation directory for the XML/Ada.

- If you are working on a big project, particularly one that includes sources in languages other than Ada, you generally have to run the three steps of the compilation process separately (compile, bind and then link). `xmlada-config` can also be used, provided you use one of the following switches:

  1. ``--cflags'`: This returns the compiler flags only, to be used for instance with `gcc`.

  2. ``--libs'`: This returns the linker flags only, to be used for instance with `gnatlink`.

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Emmanuel Briot on December, 20 2001 using texi2html