<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/07/a775e3565682015431fdeb349bd82591"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-07-02T22:45:45"
  subject="Re: [Caml-list] Question in Linking C and Ocaml"
  prev="2003/07/9d5c44985ef4846fa1879e4f91dc551f"
  next="2003/07/3444f9db4683b79f42ccc688703d54b7"
  prev-in-thread="2003/07/9d5c44985ef4846fa1879e4f91dc551f"
  prev-thread="2003/07/49d3704bd9b76044d06a619f87144574"
  next-thread="2003/07/49ed1832a167d71344f550f25717a45f"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Question in Linking C and Ocaml">
<msg 
  url="2003/07/9d5c44985ef4846fa1879e4f91dc551f"
  from="Jung Woon Ho &lt;unosoft@h...&gt;"
  author="Jung Woon Ho"
  date="2003-07-02T21:48:30"
  subject="[Caml-list] Question in Linking C and Ocaml">
<msg 
  url="2003/07/a775e3565682015431fdeb349bd82591"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-07-02T22:45:45"
  subject="Re: [Caml-list] Question in Linking C and Ocaml">
</msg>
</msg>
</thread>

<contents>
On Wed, 2 Jul 2003, Jung Woon Ho wrote:

&gt; Hi,
&gt; Im trying to link some Ocaml files to my C program. And I'm having 
&gt; difficulties in liking them together.
&gt; here is what I do....
&gt; 
&gt; 1)  compile all my Ocaml src code with the following command.
&gt; ocamlopt -c -output-obj  &lt;filenames&gt;

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.

&gt; Gives me the following errors:
&gt; 
&gt; sched/sched.a(modwrap.o)(.text+0x27): In function `fib':
&gt; : undefined reference to `caml_named_value'
&gt; sched/sched.a(modwrap.o)(.text+0x42): In function `fib':
&gt; : 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

</contents>

</message>

