[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alain Frisch <alain@f...> |
| Subject: | Re: [Caml-list] Interface C and Caml |
David LONY wrote: > ocamlopt -output-obj truc.ml -o truc.o > gcc -c test.c > gcc -o test test.o truc.o -L/usr/lib/ocaml/3.09.2 -lasmrun Two problems here: 1. the first line first compiles truc.ml into truc.cmx/truc.o as usual, and then combine truc.o with stdlib.a and a temporary startup object into truc.o. It seems that the linker first creates a fresh truc.o file before reading the existing truc.o, so the native code produced by the compiler is actually lost. You should use a different file name: ocamlopt -output-obj truc.ml -o truc_main.o 2. the last line should mention the -lm and -ldl libraries, as can be found by: grep NATIVECCLIBS `ocamlc -where`/Makefile.config So: gcc -o test test.o truc_main.o -L/usr/lib/ocaml/3.09.2 -lasmrun -lm -ldl -- Alain