1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on October, 7 2003 by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HEAD>
<TITLE>The Ada95 XML Library: Using the library</TITLE>
<META NAME="description" CONTENT="The Ada95 XML Library: Using the library">
<META NAME="keywords" CONTENT="The Ada95 XML Library: Using the library">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC15"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="xml_5.html#SEC14"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ > ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[ << ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="xml.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ >> ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="xml.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="xml_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="xml_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 6. Using the library </H1>
<!--docid::SEC15::-->
<P>
</P><P>
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.
</P><P>
There are several ways to do it:
</P><P>
<UL>
<LI>The simplest is to use the <CODE>xmlada-config</CODE> script, and let it
provide the list of switches for <CODE>gnatmake</CODE>. This is more
convenient on Unix systems, where you can simply compile your application
with
<P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>gnatmake main.adb `xmlada-config`
</FONT></pre></td></tr></table></P><P>
Note the use of backticks. This means that <CODE>xmlada-config</CODE> is
first executed, and then the command line is replaced with the output of
the script, thus finally executing something like:
</P><P>
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>gnatmake main.adb -Iprefix/include/xmlada -largs -Lprefix/lib \
-lxmlada_input_sources -lxmlada_sax -lxmlada_unicode -lxmlada_dom
</FONT></pre></td></tr></table></P><P>
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
<TT>`Makefile'</TT>, to be used with the <CODE>make</CODE> command, and copy-paste
the output of <CODE>xmlada-config</CODE> into it.
</P><P>
<CODE>xmlada-config</CODE> has several switches that might be useful:
</P><P>
<OL>
<LI><SAMP>`--sax'</SAMP>: 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.
<P>
<LI><SAMP>`--static'</SAMP>: 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.
<P>
<LI><SAMP>`--static_sax'</SAMP>: Combines both of the above flags.
<P>
</OL>
<P>
<LI>On Windows system, you might also simply want to register once and for
all the library in the Windows registry, with the command <CODE>gnatreg</CODE>.
This means that <CODE>GNAT</CODE> will automatically find the installation
directory for the XML/Ada.
<P>
<LI>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).
<CODE>xmlada-config</CODE> can also be used, provided you use one of the
following switches:
<P>
<OL>
<LI><SAMP>`--cflags'</SAMP>: This returns the compiler flags only, to be used
for instance with <CODE>gcc</CODE>.
<P>
<LI><SAMP>`--libs'</SAMP>: This returns the linker flags only, to be used for
instance with <CODE>gnatlink</CODE>.
<P>
</OL>
<P>
</UL>
<P>
<HR SIZE="6">
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[ << ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ >> ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="xml.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="xml_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="xml_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
by <I>Emmanuel Briot</I> on <I>October, 7 2003</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
</BODY>
</HTML>
|