English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] changing link order results in segfault
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-30 (22:43)
From: Eric Stokes <eric.stokes@c...>
Subject: [Caml-list] changing link order results in segfault
Hello, I have run into a problem which I thought I should bring to the 
attention of the list.
Please keep in mind, I'm not an expert in the compiler, or the runtime 
(I've not even read the code), so
please go easy on me :-)

I'm working on a project which uses Shawn Wagner's xmlrpc library, with 
the ocaml-http library
(an http server library), and I've noticed that a strange thing happens 
when I change the order in
which these libraries are linked into my executable. All this is with 
ocamlopt, I have not tried ocamlc.

If I link to ocaml-http first, and then to xmlrpc, everything is fine, 
the program runs and works correctly.
However, if I change the order of the link, if I link xmlrpc first, and 
then ocaml-http, the program segfaults
before it ever gets to my code. This behavior is consistent on linux 
intel, and darwin ppc.

I spent quite a while debugging this, so here are some thoughts for you 
all to correct :P

xmlrpc uses two libraries of note, netclient, and ocaml-http. 
Interestingly, both netclient, and ocaml-http define
a module called http_client. xmlrpc itself is split into two archives, 
one implementing the protocol and depending
on a web server, and the other using ocaml-http to build a servlet. The 
part implementing the client
uses netclient exclusively, it does not require ocaml-http. The part 
which builds the servlet uses the http_daemon
module of ocaml-http, but not the http_client module. My program links 
to both parts, and so requires the
http_client module, however there are two archives which implement a 
module with that name. It seems that
the last module with the right name on the link command line is the one 
who's code is actually used, regardless
of their type signatures (which are very different for the two 
http_client modules).

I'd be happy to provide more information upon request.

	-Eric Stokes

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners