From: Alain Frisch <alain@frisch.fr>
To: David LONY <david.lony@pragmadev.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Interface C and Caml
Date: Thu, 03 Jan 2008 21:03:02 +0100 [thread overview]
Message-ID: <477D3F76.6040401@frisch.fr> (raw)
In-Reply-To: <477CF73B.9050406@pragmadev.com>
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
next prev parent reply other threads:[~2008-01-03 20:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 14:54 David LONY
2008-01-03 20:03 ` Alain Frisch [this message]
2008-01-04 9:24 ` [Caml-list] " David LONY
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=477D3F76.6040401@frisch.fr \
--to=alain@frisch.fr \
--cc=caml-list@yquem.inria.fr \
--cc=david.lony@pragmadev.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox