Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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