caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jung Woon Ho" <unosoft@hotmail.com>
To: caml-list@inria.fr
Cc: unosoft@hotmail.com
Subject: [Caml-list] Question in Linking C and Ocaml
Date: Wed, 02 Jul 2003 21:48:26 +0000	[thread overview]
Message-ID: <BAY1-F54sTDWWcuZcGw00018e4c@hotmail.com> (raw)

Hi,
Im trying to link some Ocaml files to my C program. And I'm having 
difficulties in liking them together.
here is what I do....

1)  compile all my Ocaml src code with the following command.
ocamlopt -c -output-obj  <filenames>
2) compile my C file using GCC (obtain object files)
3) compile my C file that calls the OCAML function with ocamlc -c (obtain 
object files)
     ar -rv sched.a mod.a and all the object files produced above. (obtain 
sched.a)
4) ranlib sched.a
5) finally in the main Makefile when I try to link the sched.a (produced 
above) using
g++ -L/usr/include -O3 -DHAVE_CONFIG_H  myfiles.o sched/sched.a -lncurses 
-lm -ldl

Gives me the following errors:

sched/sched.a(modwrap.o)(.text+0x27): In function `fib':
: undefined reference to `caml_named_value'
sched/sched.a(modwrap.o)(.text+0x42): In function `fib':
: undefined reference to `copy_string'
sched/sched.a(modwrap.o)(.text+0x53): In function `fib':
: undefined reference to `callback'
sched/sched.a(modwrap.o)(.text+0x88): In function `format_result':
: undefined reference to `caml_named_value'
sched/sched.a(modwrap.o)(.text+0xab): In function `format_result':
: undefined reference to `callback'
collect2: ld returned 1 exit status

I tried different variations of what I explainded above and I cant get it to 
link together.
Can somebody help me with this?

This is my second day stuck with this problem, any kind of help will be 
greatly apreciated.
thank you very much.

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus

-------------------
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


             reply	other threads:[~2003-07-02 21:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-02 21:48 Jung Woon Ho [this message]
2003-07-02 22:44 ` Brian Hurt

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=BAY1-F54sTDWWcuZcGw00018e4c@hotmail.com \
    --to=unosoft@hotmail.com \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).