Re: [xml] Generating a correct xml2-config for use with --libs
- From: Daniel Veillard <veillard redhat com>
- To: Gary Pennington <Gary Pennington sun com>
- Cc: Stefan Kost <kost imn htwk-leipzig de>, xml gnome org
- Subject: Re: [xml] Generating a correct xml2-config for use with --libs
- Date: Thu, 13 Jun 2002 10:22:27 -0400
On Thu, Jun 13, 2002 at 02:30:08PM +0100, Gary Pennington wrote:
Stefan Kost wrote:
Hi Gary,
but libxml2 does networking (see nanoftp and the likes).
Stefan
I know, which is why libxml2 links with the appropriate libraries
(-lsocket etc). However, that doesn't mean that any application which
links with libxml2 must also link with the networking libraries.
For instance, if I have foo.c:
#include <libxml/parser.h>
<blah>
int
main(void)
{
xmlDocPtr doc = NULL;
doc = xmlNewDoc(BAD_CAST "1.0");
(void) printf("hello world\n");
<do things which are completely unrelated to networking>
return (0);
}
And I compile it as:
cc -o foo foo.c -I/usr/local/libxml/include/libxml2
-R/usr/local/libxml/sparc/lib -L/usr/local/libxml/sparc/lib -lxml2
That will work. It's the job of the linker to work out the libxml2 uses
networking libraries and needs to also link -lsocket (etc) at runtime.
xmlNewDoc can dereference the socket code. Moreover not all system
have shared library, some don't even have dynamic ones.
i.e. the application is only dependant on lxml2, but the linker has
The application you shown may have to use the network. If there is
a catalog and the filename you gave is redirected to a network URL
libxml2 will use the ftp/http stack accordingly.
worked out (correctly) that libxml2 in turn depends on a number of
libraries (e.g. libz, libsocket, etc..)
Some linkers can't.
As I said in my earlier mail, I find it hard to believe that you have to
specify a libraries dependant libraries when you link an application
with the library in order for it to work. What happens if you miss a
library out because you don't know about it?
The make stops complaining about missing symbols. And honnestly
I prefer this to happen at compile time than at run-time !
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]