Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Question in Linking C and Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <brian.hurt@q...>
Subject: Re: [Caml-list] Question in Linking C and Ocaml
On Wed, 2 Jul 2003, Jung Woon Ho wrote:

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

Is there a reason you're producing C code here?  I've had good results 
just doing:

1) Use ocamlopt -c on ocaml files to produce .cm[oi] files (note: no 
-output-obj here).
2) Use gcc -c on C files to produce .o files
3) Use ocamlopt to link .cmo and .o files.

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

It looks like you might need to link in some Ocaml-specific libraries.  

Brian


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