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
ocamlopt and linking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-12-12 (09:04)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] ocamlopt and linking
> I'm trying to link an ocamlopt-generated object file into a C program by 
> following instructions on http://caml.inria.fr/ocaml/htmlman/manual032.html
> Currently it seems that main is already defined in libasmrun and some 
> symbols are missing from it.
> cc -L /usr/lib/ocaml -lasmrun -ldl -lm -lcurses -o prog modwrap.o 
> mod_from_ml.o main.c

You have a linking order problem.  Remember that Unix linkers are
*very* sensitive to the order of libraries on the command-line.
(See the Info page for gcc, section "Options for linking", for more info.)
Just put the libraries (-lxxx) last on the line and everything will
work fine.

- Xavier Leroy